LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine if 2 IPs are on the same subnet

Solved!
Go to solution

Hi all!

I have a Client/Server connection on a network, and I wish to determine whether they are part of the same subnet.

The server is installed on a NI cFP-2220, so I can not use any system exec commands to access the network settings.

 

My code so far is just determine whether the client and server are both on localhost.

 

Please see attachment!

 

Regards

Paul

 

0 Kudos
Message 1 of 3
(2,755 Views)

Hi,

 

I will try aswer.

 

Lets M as Local Host Subnet mask,

       H as Local Host IP and

       R as Remote Host IP

 

Do the bitwise oprations

 

 (H and M) xor R

 

If 0 then the Subnets of Remote and Local hosts are same.

 

 

 

0 Kudos
Message 2 of 3
(2,741 Views)
Solution
Accepted by topic author sandal

Hi!

Thanks for replying.

 

After searching google, I think this is the right way to do it: (Ref)

 

(M and H) xOR (M and R)

 

same lan.png

 

Thank you for leading me on the right track!

 

Regards,

Paul

Message 3 of 3
(2,726 Views)