AW: Re: [En-Nut-Discussion] Webserver Image problem

Oliver Schulz olischulz at web.de
Thu Dec 18 22:10:32 CET 2003


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!

Regards,
Oliver.




More information about the En-Nut-Discussion mailing list