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
requested.

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),
use sendall.

Otherwise, use send and make sure to read and process its return value.

- Philipp

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 ?
> 

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to