aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes How to get client's remote IP address? 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 "How to get client Watch "How to get client New topic
Author

How to get client's remote IP address?

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

How would you go about getting a client's remote IP address? I've looked at InetAddress and it only gives local.
Thanks,
cc11rocks


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

Socket has methods getLocalAddress(), getLocalSocketAddress() and getRemoteSocketAddress(). Something tells me that one of these can help you out


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

Didn't see the Remote method.
Thank you very much!
cc11rocks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get client's remote IP address?