AW: AW: Re: [En-Nut-Discussion] Webserver Image problem
Dusan Ferbas
dferbas at dfsoft.cz
Sun Dec 21 22:45:43 CET 2003
Hi Oliver,
I saw your later contribution where you state fclose() is sufficient for
streamed socket.
I use explicit fflush() just before fclose(). But this does not help. When
number of packets is minimized this really helps (I sent you my
NutTcpDeviceWrite() modification). But lost FIN is still there. If you want
I can send you an application .hex file with which you can capture lost FINs.
Regarding RST. If http server claims 'Content-length' and it sends more
data then web browser sends RST to it. Maybe this can help some guys.
>Hi All,
>
>comming back to this 'TCP sockets and FIN/RST packets', some thoughts from
>me:
>
>When using fwrite or fprintf on a socket stream, the output is internaly
>routed to 'NutTcpDeviceWrite', which provides some buffering for small data
>packets. If writing less then 64 bytes data to the socket stream, the data
>is buffered and not sent to the nic.
>
>But if there are some bytes in the buffer and the stream is closed by fclose
>these bytes are not sent to the nic and the buffer is lost. Even
>NutTcpCloseSocket does not check the output buffer. (Hope I did not overlook
>something..)
>
>Because this buffering is done by the device i/o functions and not by the
>stream functions, I suggest to add a buffer flush in NutTcpCloseSocket.
>
>The other option is to add fflush in fclose.
>
>Responses and opinions are welcome!
Dusan
More information about the En-Nut-Discussion
mailing list