AW: [En-Nut-Discussion] fprintf() on streamed TCP socket

Dusan Ferbas dferbas at dfsoft.cz
Fri Dec 12 13:15:39 CET 2003


Hi Oliver,

thanks for explanation. 64 and 256 makes sense. I agree that it will be 
nice to have this settable e.g. through NutTcpSetSockOpt().

However I am getting TCP packets with e.g. 19 data bytes if I use 
fprintf_P() instead of sprintf_P() + successive fprintf() /of course I can 
then use NutTcpSend() for direct output/.

As soon as I change to sprintf to a local buffer this behaviour is gone. I 
checked NutTcpDeviceWrite() and I cannot understand why 19 bytes forces output.

         sprintf_P(data, bin_row_P
         , color
         , name
         , type
         , alarm_type;
         fprintf(stream, data);


>Hi Dusan,
>
> > When I use multiple fprintf() calls with small amount of
> > data, it seems to
>How many bytes are a "small amount of data"?
e.g. 19 bytes. Yes I got TCP packets with 19 bytes data portion. Really.

>I assume, that you use something like that:
>sock = NutTcpCreateSocket();
>NutTcpConnect(...);
>fd = _fdopen ((int) sock, ...);
yes


Dusan




More information about the En-Nut-Discussion mailing list