Skip to content
Snippets Groups Projects
Commit 804145da authored by Sander van Veen's avatar Sander van Veen
Browse files

Single character receiver.

parent 820cf465
No related branches found
No related tags found
No related merge requests found
......@@ -21,15 +21,13 @@ class Client:
totalsent = totalsent + sent
def receive(self):
msg = ''
while len(msg) < self.MSGLEN:
chunk = self.sock.recv(self.MSGLEN-len(msg))
while True:
chunk = self.sock.recv(1-len(msg))
if not chunk:
raise RuntimeError("socket connection broken")
msg = msg + chunk
return msg
print '< %s' % chunk
if __name__ == '__main__':
client = Client()
client.connect('ow150.science.uva.nl', 16897)
print '< %s' % client.receive()
client.receive()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment