On Apr 26, 7:25 am, Irmen de Jong <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Until now, I've been > > doing this little trick: > > > data = client.recv(256) > > new = data > > while len(new) == 256: > > new = client.recv(256) > > data += new > > Are you aware that recv() will not always return the amount of bytes asked > for? > (send() is similar; it doesn't guarantee that the full buffer you pass to it > will be > sent at once) > > I suggest reading this:http://www.amk.ca/python/howto/sockets/sockets.html > > --irmen
So every time I use I want to send some thing, I must use totalsent = 0 while sent < len(data): sent = sock.send(data[totalsent:]) totalsent += sent instead of a simple sock.send(data)? That's kind of nasty. Also, is it better then to use sockets as file objects? Maybe unbuffered? -- http://mail.python.org/mailman/listinfo/python-list