AW: [En-Nut-Discussion] TCP Error No. 10057

Harald Kipp harald.kipp at egnite.de
Wed Jan 25 13:50:00 CET 2006


Hi Joachim,


>i used ethereal to get more infos about my problem, and i saw that my peer 
>sends the data, ethernut tried to receive, but at this
>point ethernut closed the connection.
>
>i dont have any ideas what i can do to prevent this error.
>
>if my source will help anyone, i can send it directly.

Well, the problem is that your code is complex, consisting of
several thousand lines of code, running 4-5 threads, containing
several compile options and requires some external hardware to
test it.

If you think, that Nut/OS causes the problem, please setup a
simple sample that demonstrates the problem.

Beside other things when checking your code I stumbled over
things like

                 if ((sock = NutTcpCreateSocket()) != 0) {
                         sock->so_local_port = 1047;
                         if (NutTcpConnect(sock, tcpsrv_adress, srv_port) 
== 0) {

I do not think it's a good idea to override the local port
chosen by Nut/Net. Furthermore I can't find where you close
a socket after a connection close, except:

                 if ((sock = NutTcpCreateSocket()) != 0) {
...code removed...
                 }
                 else {
                         printf("Error creating Socket\n");
                         NutTcpCloseSocket(sock);
                         NutTcpDestroySocket(sock);
                 }

which looks completely wrong to me. If NutTcpCreateSocket fails,
you should not use sock anymore, not even for closing.

I'm sorry, but my conclusion is, that Nut/OS is fine and your
application is buggy. At least as long as no one demonstrates
that I'm wrong. :-)

I'd recommend to try the code on the PC first (Win32 or Linux).
There are much better possibilities for testing available. As
soon as this works reliable on the PC, it's usually a snap to
port it to Nut/OS, replacing beginthread() by NutThreadCreate(),
send() by NutTcpTransmit() etc.

Harald








More information about the En-Nut-Discussion mailing list