Hi , Iam developing a web-service which has the given functionality. a) Any client registers to a web-service and that is given back a client-identity-key which comprises of ip and a secret key. b) The second time the client comes with the idetity-key to the service and the service authenticates the client through the service. Here is the issue , during resgistation i can get the IP address of the client , but i need to get the netmask of the ipaddress coming through http. so that i combine the ip+netmask and give back to the client. During authentication i verify the client comes from the same IP if not atleast from the same netmask. (for VB clients there is a new IP given everytime the machine is rebooted ,and also the service is within the firewall) Here are the list of questions : 1) How do i get a netmask from a given IP address ? 2) How do i get to find that a given IP falls inside the same network when given a netmask ? This is a very urgent requirement , please help me out. Thanks Vignesh
The subnet mask is a number used in interpreting an address. You can't derive a subnet mask from the address -- if you could, then what good would it be? It wouldn't add any information, right? On top of this, these days, the notion of an address is very flexible. A NAT box can be used to hide thousands of machines behind a single IP address (which would obviously spell doom for your authentication scheme!) So I think your whole scheme needs to be rethought.