Bryan, > > Sion Arrowsmith is right about what causes the delay. > Just in case your real code looks like this, I'll note: > >> len, = struct.unpack("!i", s.recv(4)) >> data = s.recv(len) yes, my mistake ;)
> > > First, you almost certainly don't want to use the name 'len'. > Ought not to be allowed. Second, recv can return fewer bytes > than requested, even when the connection is still open for > reading. You might replace the lines above with (untested): > > length = struct.unpack("!i", s.recv(4)) > data = [] > while length: > data.append(s.recv(length)) > length -= len(data[-1]) > data = ''.join(data) > > i know, i know, i sent fake python client: the real will be done in java. > There's still a robustness problem, but in the absense of errors > and malice, that should work. I think. > > -- http://mail.python.org/mailman/listinfo/python-list