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

Single character receiver.

parent 820cf465
......@@ -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()
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