Problem receiving UDP broadcast packets.

Irmen de Jong irmen.NOSPAM at xs4all.nl
Tue Apr 19 19:13:50 EDT 2011


On 20-4-2011 0:21, Grant Edwards wrote:
> I'm have problems figuring out how to receive UDP broadcast packets on
> Linux.
> 
[...]

> Here's the sending code:
> 
> --------------------------------send.py-------------------------------
> #!/usr/bin/python
> import sys,socket,time
> 
> host = sys.argv[1]
> port = 5010
> 
> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
> s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
> s.bind((host,port))

I don't think you should use s.bind() at all in the sending code.
Could that be at least part of the problem?


-Irmen



More information about the Python-list mailing list