Hi MRAB, My code now works thanks to your advice.
{"msgver": "1.0", "msgid": "200", "subcode": "100", "appver": "1.0", "appid": "1.0", "data": {"1": "igb0", "2": "igb1", "ifcnt": "2"}} connected to misty:8080 sending data 138 bytes sent: 0x86{"msgver": "1.0", "msgid": "200", "subcode": "100", "appver": "1.0", "appid": "1.0", "data": {"1": "igb0", "2": "igb1", "ifcnt": "2"}} receiving data message length is 188 188 bytes received: { "msgver": 1.000000, "appver": 1.000000, "appid": 1000, "msgid": 10, "subcode": 20, "data": [ "110.159.183.16", "124.108.16.94", "2400:3700:50::2", "2400:3700:50::1", "2400:3700:51::" ] } Many thanks. On Feb 11, 2013, at 9:55 AM, MRAB <pyt...@mrabarnett.plus.com> wrote: > You should keep reading until you get all need or the connection is > closed: > > buf = b'' > while len(buf) < nbuf: > chunk = sock.recv(nbuf - len(buf)) > > if not chunk: > break > > buf += chunk > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list