Can't receive UDP broadcast in python
<p>Here is broadcast server</p>

<pre><code>from time import sleep
from socket import *

PORT = 50000
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)

data = "I am server"
while 1:
    s.sendto(data, ('&lt;broadcast&gt;', PORT))
    print "sent data"
    sleep(5)
</code></pre>

<p>Please note that you need to change <code>'&lt;broadcast&gt;'</code> with actual broadcast address of your network.  Please see <a href="https://stackoverflow.com/questions/25995425/python-cant-send-a-broadcast-package-with-broadcast-address">Python can't send a broadcast package with  address
</a></p>

<p>Here is broadcast receiver</p>

<pre><code>from socket import socket, AF_INET, SOCK_DGRAM
PORT = 50000
client = socket(AF_INET, SOCK_DGRAM)
client.bind(('0.0.0.0', PORT))
data, addr = s.recvfrom(1024) #sticks here forever!

if data:
    print "Found Broadcast server at : " + addr
</code></pre>

<p>But problem is that my receiver just sticks at <code>s.recvfrom(1024)</code>
While through tcpdump I am able to see the packet, then why this python client is not able to catch it ?
command is <code>sudo tcpdump -i wlan0 ip -X dst host 255.255.255.255</code></p>