This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

NetMask,IPAddress clarification

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic