Discovery IP in connection

Roy Smith roy at panix.com
Mon Jul 27 19:21:43 EDT 2009


In article <mailman.3797.1248726749.8015.python-list at python.org>,
 Djames Suhanko <djames.suhanko at gmail.com> wrote:

> Hello,all!
>  I wrote a little programa that listening UDP packets. A can receive
> the messages, but I can't see the the origin IP.
>  How can I to  get the remote IP address in connection?
> 
> My source:
> 
> #!/usr/bin/env python
> import socket
> mySocket = socket.socket ( socket.AF_INET, socket.SOCK_DGRAM )
> mySocket.bind ( ( '', 514 ) )
> 
> data, addr = mySocket.recvfrom(100)
> print data

What happens when you print addr?



More information about the Python-list mailing list