Given a subnet mask, how to verify if an IP falls in that subnet.

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2008
Posts: 6
Reputation: beckman16 is an unknown quantity at this point 
Solved Threads: 0
beckman16 beckman16 is offline Offline
Newbie Poster

Given a subnet mask, how to verify if an IP falls in that subnet.

 
0
  #1
Apr 8th, 2009
Hi, I have a scenario wherein I need to give access of a system to the hosts of a subnet. For that I need to verify if the incoming request is from the IP which falls within the subnet. Is there some way to do that automatically using c# functionality.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: Given a subnet mask, how to verify if an IP falls in that subnet.

 
0
  #2
Apr 8th, 2009
subnet info is not embedded to ip address, it is not in that context.
subnet mask can be anything for a given ip address. subnet masks are used to group ip addresses. what you can know about ip address could only be its type like a,b or c.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 6
Reputation: beckman16 is an unknown quantity at this point 
Solved Threads: 0
beckman16 beckman16 is offline Offline
Newbie Poster

Re: Given a subnet mask, how to verify if an IP falls in that subnet.

 
0
  #3
Apr 8th, 2009
It is like with given subnet 255.255.255.224, its not possible to have a host with IP 192.168.10.32.
Last edited by beckman16; Apr 8th, 2009 at 4:15 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: Given a subnet mask, how to verify if an IP falls in that subnet.

 
0
  #4
Apr 9th, 2009
Check this cool bit of code out:

http://blogs.msdn.com/knom/archive/2...-networks.aspx

This guy has a pretty slick solution!
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC