Last active
August 29, 2015 14:10
-
-
Save robinfang/d82908a06f422d994328 to your computer and use it in GitHub Desktop.
发送udp广播到局域网
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 * | |
| cs = socket(AF_INET, SOCK_DGRAM) | |
| cs.bind(("10.22.13.19",54545)) # http://is.gd/73aRUm for detail | |
| cs.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) | |
| cs.sendto('This is a test', ('255.255.255.255', 54545)) | |
| # tcpdump http://is.gd/gw2OBN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment