Mac Os/X host name
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   rabab3012_rabab123
Posted On:   Wednesday, June 5, 2002 03:09 AM

I developed java application, one of functions of this application is get ip address of the machine code uses : InetAddress inet=InetAddress.getLocalHost(); String hostName=inet.getHostName(); String ip=inet.getHostAddress(); System.out.println("ip ="+ip+" hostName ="+hostName); when i run this code on Mac Os X the result is ip=127.0.0.1 hostName=LocalHost and when run it on Windows or Unix os the result is ip=129.45.33.4 hostName=xx in case Mac OS/X the program get local host ip 127.0.0.1 i dont need this result i need machine ip address like the result in windows and unix , java is run any where as same behavior which means there is some thing wrong in configuratio   More>>

I developed java application, one of functions of this application is get ip address of the machine
code uses :
InetAddress inet=InetAddress.getLocalHost();
String hostName=inet.getHostName();
String ip=inet.getHostAddress();
System.out.println("ip ="+ip+" hostName ="+hostName);
when i run this code on Mac Os X the result is
ip=127.0.0.1 hostName=LocalHost
and when run it on Windows or Unix os the result is
ip=129.45.33.4 hostName=xx
in case Mac OS/X the program get local host ip 127.0.0.1 i dont need this result i need machine ip address like the result in windows and unix , java is run any where as same behavior which means there is some thing wrong in configuration of Mac Os/x machine but i check tcp/ip configuration of it (this machine on LAN ,have static ip ).
Default host name in Mac OS/X is LocalHost this is the problem i think if i can change it i will reach to correct result from my program but how change it programmatically?
Any one has any suggestion for this problem please help me .
thanks

   <<Less
About | Sitemap | Contact