File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes ip or name of server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "ip or name of server" Watch "ip or name of server" New topic
Author

ip or name of server

siva prakash
Ranch Hand

Joined: Aug 24, 2004
Posts: 80
Hi all,

i am having application that runs in one of many servers ( due to load balancing). i need to find the server ip or its name in which the request is processed. i should not use servletrequest object.

is there any way.


With Regards,
prakash.
Jean-Sebastien Abella
Ranch Hand

Joined: Jul 29, 2005
Posts: 60
I do not know if there is one more specific to your problem but if you are on windows(I'm sure there would be an equivalent on other platform)
the command "ping -a localhost" will give you the name of the current machine
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
See if NetworkInterface.getNetworkInterfaces() and then anInterface.getInetAddress() does what you need. They might come up with more than one answer
[ September 07, 2005: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ip or name of server
 
Similar Threads
IP address
JDBC, ODBC, Drivers, etc.
InetAddress
Read Client IP Address behind Proxy
InetAddress