|
Boost : |
Subject: Re: [boost] [asio] Randomly having problems reading from the socket
From: Cliff Green (cliffg_at_[hidden])
Date: 2011-05-05 10:30:18
The symptoms you describe, based on the code you included in your first
e-mail, seems to point to a simple and straightforward problem - you're
running into TCP flow control blockage. This is a traditional TCP problem
and is not directly related to Asio.
Anytime you're sending data as fast as possible, and the receiving side is
just slightly slower at receiving the data, send buffers in the OS will fill
up. Eventually this will result in the send being blocked for a short period
of time while the receiving side processes the data. If you're using
blocking writes, the send will block for a period of time. If you're using
async writes, the write completion handler will take longer before it is
called (which is why I greatly prefer async operations all around).
That the problem is transitory and takes a while to manifest is another
clue - it depends totally on how fast the sending and receiving applications
are running, and if there's a short period on the receiving side where the
app can't run as fast (e.g. another app takes up some processing time), the
blockage will be transitory.
Cliff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk