aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes how to get client ip from socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "how to get client ip from socket" Watch "how to get client ip from socket" New topic
Author

how to get client ip from socket

Isaac Jones
Greenhorn

Joined: Jun 18, 2004
Posts: 25
hi,
i've been trying to find out how to get the clients ip all day long now. i hope someone can help me here. i have a serverSocket running on my server. in a while loop i have a socket=serverSocket.accept() waiting for clients to connect. how can i find out the clients ip? shouldn't it be in the socket? i've tried several different functions but all i get is the ip of my server. anyone got any ideas?
here is part of my code:



thanks, sgl
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8705
    
    6

Socket.getRemoteSocketAddress()


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
 
subject: how to get client ip from socket
 
Similar Threads
Multiple sockets cause Threads Hangin
Need help with Connection Error
Server / Client with Threads
Why should I use a new Socket to interrupt serverSocket.accept() ?
ServerSocket crash with Thread