From: Jim Weirich Date: 2003-04-04T09:29:57+09:00 Subject: Re: Clarification: read/write slow, and TCPSocket and sys{read,write} On Thu, 2003-04-03 at 16:06, Ryan Pavlik wrote: [...] > The slow part is when I send the object, get the reply, send the object, > get the reply, etc. Perhaps it is not the read/write speed that is killing you, but the latency in the network. For example, let's suppose that sending an object can be done really fast (for example, 0.01 seconds), but getting a response takes a long time (lets say 1 second to really exagerate the difference). If I send a messages and wait for a response, it will take 0.01 + 1 + 0.01 seconds, or 1.02 seconds for each message. Sending 100 messages in this manner will take 102 seconds. If I send 100 messeges (2 seconds), wait (1 second), and then receive 100 messages (another 2 seconds), the whole thing will take 5 seconds total. If latency is really your problem, you might want to consider some kind of buffering scheme where X number of messages can be sent before a response is expected. Any book on communication protocols should cover the basics. -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)