falkaholic Posted April 25, 2002 Share Posted April 25, 2002 I am making a calculation that compares IP addresses to see if they are the same. That is easy enough, but I also want to check to see if they are on the same sub net. for example: 55.56.57.56 55.56.57.69 are not the same IP but they are on the same subnet, because the first 3 numbers on the same but the last is different. But each of the numbers can be 1 to 3 digits and can't just compare the left X numbers, i just want to see if the first 3 are the same. How would your left brain do that? Link to comment Share on other sites More sharing options...
LiveOak Posted April 26, 2002 Share Posted April 26, 2002 You need to treat the IP address as a text string. This test will return a 1 if the subnets match (1.2.3.x = 1.2.3.y) Left(IP1, Position(IP1, ".", 1, 3) - 1) = Left(IP1, Position(IP2, ".", 1, 3) - 1) -bd Link to comment Share on other sites More sharing options...
BobWeaver Posted April 29, 2002 Share Posted April 29, 2002 Be careful. The first 3 numbers do not necessarily specify the subnet. You need to check the subnet mask. If it's 255.255.255.0 then fine, but this isn't always the case in large organizations with large networks. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 8198 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now