[En-Nut-Discussion] Problems with TCP-Sendbuffer size(?)
nategoose at gmail.com
Thu Oct 13 16:59:11 CEST 2011
On Thu, Oct 13, 2011 at 10:48 AM, Ole Reinhardt
<ole.reinhardt at embedded-it.de> wrote:
> Hello Klaus,
> > fflush() was the solution. The second problem, stopping at 1005 Bytes, was on my side.
> > Do I have to take care to call fflush() at least every 512 bytes?
> No, it just sends out any pending data. So just call it once you gave
> everything that should be send out up to this moment.
So if you are implementing a command/response type protocol then you
would need to make sure you call
fflush before each place where you expect to get information in
response to what you have sent.
If you are implementing a protocol that requires something like:
then after writing "Username:" you would need to have a fflush to make
sure that that data was sent before you
started waiting on "them" to send you the response. Without this they
might not get the "Username:"
data in a timely manner and both you and them would be waiting on you
to send "Username:".
You also need to call fflush after writing "Password:" in this example.
More information about the En-Nut-Discussion