aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes NetworkInterface.getByInetAddress() in a remote computer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "NetworkInterface.getByInetAddress() in a remote computer" Watch "NetworkInterface.getByInetAddress() in a remote computer" New topic
Author

NetworkInterface.getByInetAddress() in a remote computer

Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
This is the code I have. Obviously it doesn't work because the given ip is a remote computer.

My question is:is it possible to use some sort of this code (something similar) to get the NetworkInterface of a remote machine?




thanks in advance,


Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
Assuming you have a connection via Socket, you can look at the socket class, you will see a method called getRemoteSocketAddress that returns a SocketAddress which will print the IP address and port of the other endpoint. That is probably the most direct way.


"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
 
 
subject: NetworkInterface.getByInetAddress() in a remote computer