Discovery IP in connection

Djames Suhanko djames.suhanko at gmail.com
Tue Jul 28 15:27:24 EDT 2009


Thanks, all!
 I didn't tried to print addr. :-(
 sorry all. I'm learning python yet.
Thanks again !

On Mon, Jul 27, 2009 at 8:23 PM, Piet van Oostrum<piet at cs.uu.nl> wrote:
>>>>>> Djames Suhanko <djames.suhanko at gmail.com> (DS) wrote:
>
>>DS> Hello,all!
>>DS>  I wrote a little programa that listening UDP packets. A can receive
>>DS> the messages, but I can't see the the origin IP.
>>DS>  How can I to  get the remote IP address in connection?
>
> What do you think the addr is for in
> data, addr = mySocket.recvfrom(100)?
>
>>DS> My source:
>
>>DS> #!/usr/bin/env python
>>DS> import socket
>>DS> mySocket = socket.socket ( socket.AF_INET, socket.SOCK_DGRAM )
>>DS> mySocket.bind ( ( '', 514 ) )
>
>>DS> data, addr = mySocket.recvfrom(100)
>>DS> print data
>
> --
> Piet van Oostrum <piet at cs.uu.nl>
> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
> Private email: piet at vanoostrum.org
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Djames Suhanko
LinuxUser 158.760



More information about the Python-list mailing list