Home arrow static arrow Java Programming [Archive] - networkmask
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - networkmask
This topic has 6 replies on 1 page.

Posts:3
Registered: 7/12/04
networkmask  
Jul 16, 2004 4:30 AM



 
Hi,

how do I get the networkmask and ip of my localhost ?

Thanks
Rudi
 

Posts:192
Registered: 30/05/01
Re: networkmask  
Jul 16, 2004 4:35 AM (reply 1 of 6)



 
on windows - run ipconfig from console
 

Posts:6,487
Registered: 5/5/04
Re: networkmask  
Jul 16, 2004 4:37 AM (reply 2 of 6)



 
You can use
InetAddress.getLocalHost().getAddress();

to get the address.

I am not sure how to get the netmask.
You could try google.
http://www.google.co.uk/search?hl=en&ie=UTF-8&q=InetAddress+netmask&btnG=Search&meta=

What do you need the netmask for?
 

Posts:3
Registered: 7/12/04
Re: networkmask  
Jul 16, 2004 4:44 AM (reply 3 of 6)



 
I want do do a broadcast in a subnet. For this i need the subnetmask
 

Posts:6,487
Registered: 5/5/04
Re: networkmask  
Jul 16, 2004 7:57 AM (reply 4 of 6)



 
Perhaps you should use a multicast address.
Or you can just use 255.255.255.255
 

Posts:3,258
Registered: 00-08-28
Re: networkmask  
Jul 16, 2004 9:52 AM (reply 5 of 6)



 
http://www.jafar.com/java/jipcalc/jipfeat.html
 

Posts:3,258
Registered: 00-08-28
Re: networkmask  
Jul 16, 2004 9:53 AM (reply 6 of 6)



 
this thread might be helpful as well

http://forum.java.sun.com/thread.jsp?thread=521892&forum=31&message=2496047
 
This topic has 6 replies on 1 page.