Issue1103213
Created on 2005-01-16 04:02 by irmen, last changed 2009-02-14 19:09 by ajaksu2.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
patch.txt
|
irmen,
2005-01-16 04:02
|
patch for Lib/socket.py and Modules/socketmodule.c |
|
|
|
msg47558 - (view) |
Author: Irmen de Jong (irmen) |
Date: 2005-01-16 04:02 |
|
This patch is a first take at adding a recvall method
to the socket object, to mirror the existence of the
sendall method.
If the MSG_WAITALL flag is available, the recvall
method just calls recv() with that flag.
If it is not available, it uses an internal loop
(during the loop, threads are allowed, so this improves
concurrency).
Having this method makes Python code much simpler;
before you had to test for MSG_WAITALL yourself and
write your own loop in Python if the flag is not there
(on Windows for instance).
(also, having the loop in C improves performance and
concurrency compared to the same loop in Python)
Note: the patch hasn't been tested very well yet.
(code is based on a separate extension module found
here: http://www.it-ernst.de/python/ )
|
|
msg47559 - (view) |
Author: Martin v. Löwis (loewis) |
Date: 2005-02-24 20:55 |
|
Logged In: YES
user_id=21627
I like the feature (but see below). The patch is incomplete,
though:
- there are no changes to Doc/lib/libsocket.tex
- there are no changes to Lib/test/test_socket.py
Furthermore, the patch is also wrong: if a later recv call
fails, all data read so far are discarded. I believe this is
different from the WAITALL flag, which I hope will preserve
the data in the socket, for a subsequent recv call. As
keeping the data in the socket seems unimplementable, the
partial data should somehow be returned to the application.
A note on coding style: please omit the spaces after the
opening paren and before the closing in
while ( (bytes_got<total_size) && (n > 0) )
|
|
| Date |
User |
Action |
Args |
| 2009-02-14 19:09:04 | ajaksu2 | set | stage: test needed type: feature request versions:
+ Python 2.7, - Python 2.5 |
| 2005-01-16 04:02:31 | irmen | create | |
|