[En-Nut-Discussion] fprintf() on streamed TCP socket
Dusan Ferbas
dferbas at dfsoft.cz
Thu Dec 11 15:18:01 CET 2003
When I use multiple fprintf() calls with small amount of data, it seems to
me that packets are generated for each fprintf call. They are generated
even for each variable output as from _putf() _putb() /(*dev->dev_write)()/
is called.
I think that output is buffered till incoming message fits in stream output
buffer. But it behaves differently.
Does it mean I have to collect everything in output buffer myself ? Then
why pair of fprintf() and fflush() exists ?
---------
I am using httpd.c example skeleton with 3 threads to cover html page + 1
image (884 bytes). I am setting available packet length with:
#define MY_TCP_MSS (1500 - 40)//TCP_MSS/*1024/*(1500 -
40)*/ //override default TCP_MSS == 536
//IP portion, +14 -> whole packet
(1514)
...
static const u_short tcp_mss = MY_TCP_MSS;
...
if (NutTcpSetSockOpt(sock, TCP_MAXSEG, &tcp_mss, sizeof(tcp_mss)))
LOG_MSG("%u. Cannot set MSS sock opt\n", id);
When I am initially sending large data (38kB) with fwrite_P() of MY_TCP_MSS
size, packets are wide enough. With fprintf() not. Any idea ?
Dusan Ferbas
www.dfsoft.cz
More information about the En-Nut-Discussion
mailing list