Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:skip:s 10': 0.05; 'exception.': 0.07; 'python': 0.09; 'blocking': 0.09; 'high- level': 0.09; 'requested.': 0.09; 'sockets': 0.09; 'throws': 0.09; 'cc:addr:python-list': 0.10; 'value.': 0.15; 'cc:name:python list': 0.16; 'filename:fname piece:signature': 0.16; 'low-level': 0.16; 'occurs.': 0.16; 'subject:between': 0.16; 'tcp': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'bytes': 0.17; 'otherwise,': 0.20; 'doc': 0.22; 'sends': 0.22; 'cc:2**0': 0.23; '(this': 0.24; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'error': 0.30; 'received:192.168.2': 0.34; 'method': 0.36; 'does': 0.37; 'sure': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'most': 0.61; 'between': 0.63; 'bothered': 0.65; 'subjectcharset:utf-8': 0.72; 'subject::': 0.83; 'what\xe2\x80\x99s': 0.84 Date: Tue, 08 Jan 2013 13:42:07 +0100 From: Philipp Hagemeister User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11 MIME-Version: 1.0 To: iMath <2281570025@qq.com> Subject: Re: =?UTF-8?B?d2hhdOKAmXMgdGhlIGRpZmZlcmVuY2UgYmV0d2VlbiBzb2NrZXQ=?= =?UTF-8?B?LnNlbmQoKSBhbmQgc29ja2V0LnNlbmRhbGwoKSA/?= References: In-Reply-To: X-Enigmail-Version: 1.4 OpenPGP: id=FAFB085C Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig434ECFCC9BA1A76C3CB3D648" Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357650581 news.xs4all.nl 6942 [2001:888:2000:d::a6]:46172 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36427 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig434ECFCC9BA1A76C3CB3D648 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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=E2=80=99s the difference between socket.send() and socket.sendall(= ) ? >=20 > It is so hard for me to tell the difference between them from the pytho= n doc >=20 > so what is the difference between them ? >=20 > and each one is suitable for which case ? >=20 --------------enig434ECFCC9BA1A76C3CB3D648 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEAREKAAYFAlDsFCEACgkQ9eq1gvr7CFyqswCgmgHImzhVDS7mlBrAKs12wD3F z6gAoKPxDxEy1GoVNAEQVlcbpxL6dqzs =Rpq5 -----END PGP SIGNATURE----- --------------enig434ECFCC9BA1A76C3CB3D648--