Last active
September 18, 2015 11:34
-
-
Save roberthartung/e3073eca4435735bf3cd to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
data = self.request.recv(4) | |
if len(data) == 0: | |
print "Length is 0. Aborting." | |
break | |
length = struct.unpack("I", data)[0] | |
offset = 0 | |
all_data = [] | |
while offset < length: | |
tmp_data = self.request.recv(length-offset) | |
if len(tmp_data) == 0: | |
print "Length is 0. Aborting." | |
break | |
offset += len(tmp_data) | |
all_data.append(tmp_data) | |
data_str = ''.join(tmp_data) | |
message = cPickle.loads(data_str) | |
print message, message.number, message.rate, message.samples |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment