Scatter/gather on sockets?
Roy Smith
roy at panix.com
Sat Apr 1 17:27:54 EST 2006
Peter Hansen <peter at engcorp.com> wrote:
> B. Don't bother trying, because even if the MTU is large enough there is
> absolutely no guarantee that the packet will stay intact all the way
> through the network anyway (even if you use sendall() instead of send()).
This is true, but I'm generating the message being sent in very small
chunks (often as small as 4 bytes at a time), and typically need to flush a
packet out onto the network after a few dozen bytes. Maybe at most a few
hundred. I don't know of any networks with MTU's smaller than that.
Measurements show a 10-fold improvement in protocol throughput with large
packets vs. small ones. The only question is what's the most efficient way
in Python to generate the large packets.
> So fixing your design not to require this appears to be the only viable
> solution.
My design is not broken. I'm writing code to drive a pre-existing binary
communications protocol. It is what it is. The functionality I seek
exists at the Unix system call level (writev, sendmsg), but doesn't appear
to be exposed in the Python socket API.
More information about the Python-list
mailing list