On 2008-03-13, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> > For example: try creating a local client/server (running on the same >> > computer) where the server sends the client a fixed amount of data. >> > Using method A, recv(8192) and sendall( ) with 8192 bytes >> > worth of data. Do this 100 times. Using method B, recv(1) and >> > sendall( ) with 1 byte worth of data. Do this 819200 times. >> >> > If you time both methods, method A has much greater >> > throughput than method B. >> >> Why is it faster to drink a liter of water a cupful at a time than to >> drink it out of an eyedropper?
> Well, lets say you have a situation where you're going to be > alternating between sending large and small chunks of data. Is the > solution to create a NetworkBuffer class and only call send when the > buffer is full, always recv(8192)? If you need to send large and small chumks of data, the solution is to send large and small chunks of data. -- Grant -- http://mail.python.org/mailman/listinfo/python-list