The callback function specified by glib.io_add_watch not called for broadcast packets
Submitted by gor..@..box.ru
Link to original bug (#777599)
Description
The callback function specified by glib.io_add_watch not called for broadcast udp datagram packets
Create socket for receive UDP datagrams with this code: receive_udp.py:
from socket import *
import glib
addr = '192.168.1.200', 40000 # actually you machine should have this ip
s1 = socket(AF_INET, SOCK_DGRAM)
s1.bind(addr)
s1.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
glib.io_add_watch(s1, glib.IO_IN, on_receive)
#...
# main loop here
# ...
def on_receive(sock, condition, units):
print 'this newer called for broadcast udp datagrams'
pass
Create socket for send UDP datagrams with this code:
send_udp.py:
s = socket(AF_INET, SOCK_DGRAM)
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
s.sendto('hi there!', ('192.168.1.255', 40000))
My system run on: ubuntu 16.10, python 2.7
Edited by Christoph Reiter