Sockets: Sending/receiving arbitrary amounts of data
Greg Ewing
see at my.signature
Tue May 1 23:45:11 EDT 2001
"Doobee R. Tzeck" wrote:
>
> Considering Python is a high level Language I ask myself
> if there shouldend be a way in Python to optionally shield the
> user (programmer) from the hassle of handling of short socket
> reads.
I think so, too. I once suggested that file.read(),
socket.recv() and similar methods should have an
optional two-argument form:
recv(min, max)
This would block until at least min bytes had
arrived, and return at most max bytes. If EOF
occurs before min bytes have arrived, an exception
is raised.
Putting min == 0 gives the current behaviour.
Putting min == max gives you a fixed-length read.
Perhaps I'll PEP this one day, too.
--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list