AW: [En-Nut-Discussion] Improve Tcp/Ip speed
olischulz at web.de
Tue Jan 27 22:41:58 CET 2004
please use the latest Nut/OS source code from CVS. There are some TCP speed
If you use NutTcpSend the output is not buffered, thus every call to
NutTcpSend generates a TCP packet even for small data.
To use output buffering you have to use streaming on the tcp socket, or use
For streaming, open a FILE with _fdopen and use fwrite, fputs or fprintf to
write to the file.
To optimize buffer handling, you can set the maximum segment size and size
of output buffer with these functions:
u_short us = 1460;
NutTcpSetSockOpt (sock, TCP_MAXSEG, &us, sizeof(us));
NutTcpSetSockOpt (sock, SO_SNDBUF, &us, sizeof(us));
The value of 1460 (bytes) is the maximum value for ethernet lan.
Please note, the the output buffer is taken from heap memory.
Hope that helps,
> -----Ursprungliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de]Im Auftrag von Alexandra
> Gesendet: Dienstag, 27. Januar 2004 22:11
> An: Ethernut User Chat (English)
> Betreff: [En-Nut-Discussion] Improve Tcp/Ip speed
> We wrote a simple program that send buffer to the EtherNut
> board and then
> reads the buffer back using NutTcpSend and NutTcpReceive
> functions. The
> timing is so that sending 1Mb of data takes ~15 seconds. How
> we can improve
> Tcp/Ip speed? Our program is very small so we can make socket
> like receiving and sending buffer sizes bigger and maybe it
> can improve TCP
> speed. I looked at the code and found that output buffer for
> tcp is 256
> bytes. Not sure exactly what is the size if receiving buffer
> , but I found
> that NutTcpSetSockOpt procedure will allow to set receive
> buffer size. What
> do you recommend for reasonable buffer size?
> Thank you.
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
More information about the En-Nut-Discussion