Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36427 > unrolled thread
| Started by | Philipp Hagemeister <phihag@phihag.de> |
|---|---|
| First post | 2013-01-08 13:42 +0100 |
| Last post | 2013-01-08 13:42 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: what’s the difference between socket.send() and socket.sendall() ? Philipp Hagemeister <phihag@phihag.de> - 2013-01-08 13:42 +0100
| From | Philipp Hagemeister <phihag@phihag.de> |
|---|---|
| Date | 2013-01-08 13:42 +0100 |
| Subject | Re: what’s the difference between socket.send() and socket.sendall() ? |
| Message-ID | <mailman.272.1357650581.2939.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
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 ? >
Back to top | Article view | comp.lang.python
csiph-web