File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "NetworkInterface.getByInetAddress() in a remote computer" Watch "NetworkInterface.getByInetAddress() in a remote computer" New topic

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
I agree. Here's the link:
subject: NetworkInterface.getByInetAddress() in a remote computer
It's not a secret anymore!