Last active
April 20, 2019 05:00
-
-
Save vo/44392196602762f8373b8f9cedb459b5 to your computer and use it in GitHub Desktop.
send and recv udp python
This file contains 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
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.bind(('0.0.0.0', 5005)) | |
while True: | |
data, addr = sock.recvfrom(65536) | |
print("received: %d" % len(data)) |
This file contains 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
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
for i in range(65507+1): | |
print('size = %d' % i) | |
sock.sendto('*' * i, ('127.0.0.1', 5005)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment