Created
July 31, 2015 20:06
-
-
Save vik-y/ab023a0c439e6caf0e68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socket import * | |
s=socket(AF_INET, SOCK_DGRAM) | |
s.bind(('',12345)) | |
m=s.recvfrom(1024) | |
print m[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A simple implementation of broadcast of packets in python | |
send.py -> How packets are broadcasted | |
receive.py -> How broadcasts are received | |
''' | |
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment