Created
December 20, 2016 02:20
-
-
Save ruoyu0088/2459b2a050fb3dc679c67920684123c2 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
import socket | |
import time | |
UDP_IP = "0.0.0.0" | |
UDP_PORT = 2368 | |
sock = socket.socket(socket.AF_INET, # Internet | |
socket.SOCK_DGRAM) # UDP | |
sock.bind((UDP_IP, UDP_PORT)) | |
start = time.clock() | |
with open("sensor.bin", "wb") as f: | |
for i in range(1000): | |
data, addr = sock.recvfrom(4096) | |
f.write(data) | |
print time.clock() - start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment