How can Client get "Client IP" ?

polarpolar polarpolar at infor.org
Thu Jul 22 09:13:27 EDT 2004


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) )
s.listen(1)
conn, addr = s.accept()
clientIP = addr
s.close()

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 ?

Thanks.



More information about the Python-list mailing list