Commit 804145da authored by Sander van Veen's avatar Sander van Veen

Single character receiver.

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