broadcast

Receiving Broadcast Packets in Python

Receiving Broadcast Packets in Python Question: I have the following code which sends a udp packet that is broadcasted in the subnet. from socket import * s=socket(AF_INET, SOCK_DGRAM) s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) s.sendto(‘this is testing’,(‘255.255.255.255’,12345)) The following code is for receiving the broadcast packet. from socket import * s=socket(AF_INET, SOCK_DGRAM) s.bind((‘172.30.102.141’,12345)) m=s.recvfrom(1024) print m[0] The problem …

Total answers: 3