what’s the difference between socket.send() and socket.sendall() ?
phihag at phihag.de
Tue Jan 8 13:42:07 CET 2013
socket.socket.send is a low-level method and basically just the
C/syscall method send(3) / send(2). It can send less bytes than you
socket.socket.sendall is a high-level Python-only method that sends the
entire buffer you pass or throws an exception. It does that by calling
send until everything has been sent or an error occurs.
If you're using TCP with blocking sockets and don't want to be bothered
by internals (this is the case for most simple network applications),
Otherwise, use send and make sure to read and process its return value.
On 01/07/2013 11:35 AM, iMath wrote:
> what’s the difference between socket.send() and socket.sendall() ?
> It is so hard for me to tell the difference between them from the python doc
> so what is the difference between them ?
> and each one is suitable for which case ?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: OpenPGP digital signature
More information about the Python-list