aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes NetMask,IPAddress clarification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "NetMask,IPAddress clarification" Watch "NetMask,IPAddress clarification" New topic
Author

NetMask,IPAddress clarification

Vignesh C Kottaiveedu
Greenhorn

Joined: Jan 27, 2004
Posts: 1
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
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

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.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NetMask,IPAddress clarification