470,604 Members | 2,020 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,604 developers. It's quick & easy.

How can Client get "Client IP" ?

Hi, All :

I wrote a simple server in Python,
and I can get the client IP by following script:

s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
s.bind( (HOST, PORT) )
conn, addr = s.accept()
clientIP = addr

That's wonderful.
However, I hope that my client can get his own IP "by himself".
( Not by server :Q )
So what can I do ?
Is there a CONST I can use ?

Jul 18 '05 #1
1 9277
For a socket object s, s.getsockname() "Return the socket's own address.
This is useful to find out the port number of an IPv4/v6 socket, for
instance. (The format of the address returned depends on the address
family -- see above.)"


Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFA/8SbJd01MZaTXX0RAuwEAJ9dZx9n1KiIOfjMdkVxvJfbRztL+QC eIkmB

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by lfo | last post: by
1 post views Thread by Jacques Cooper | last post: by
2 posts views Thread by Terry Olsen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.