|
From: | aparna.dutta |
Subject: | RE: RE : [lwip-users] Receiving RSTs |
Date: | Wed, 12 Dec 2007 13:08:50 +0530 |
I had initially tested my client code using the Windows socket API, but
apparently the behaviour of the Lwip socket API is slightly different. I have
put in the fix by closing the socket everytime connect() fails and creating a
new socket again. Hopefully this would solve the issue. Thanks a lot for all your replies, (By the way, the “sys_mbox_post: mbox not full" assertion
is in sys_mbox_post() function in sys_arch.c of the VDSP Regards, Aparna From:
address@hidden
[mailto:address@hidden On Behalf Of Frédéric BERNON I did this test with last CVS HEAD (with a static void tcp_connect_thread(void *arg) { int sock; struct sockaddr_in local; struct sockaddr_in to; int iResult; u32_t server_address; /* initialize server address */ server_address = inet_addr("192.168.0.1");/*my
pc*/ /* if we got a valid server address... */ if (server_address!=0) { /* create new socket */ sock = socket( AF_INET, SOCK_STREAM, 0); if (sock>=0) { /* prepare local address */ memset(&local, 0, sizeof(local)); local.sin_family = AF_INET; local.sin_port = htons(INADDR_ANY); local.sin_addr.s_addr = htonl(INADDR_ANY); /* bind to local address */ if (bind( sock, (struct sockaddr *)&local,
sizeof(local))==0) { /* prepare server address */ memset(&to, 0, sizeof(to)); to.sin_family = AF_INET; to.sin_port = htons(62345);/* a port which is not opened*/ to.sin_addr.s_addr = server_address; /* connect to server */ if ((iResult=connect( sock, (struct sockaddr *)&to,
sizeof(to)))>=0) { printf("connected success==%i [%i]\n", iResult,
errno); } else { printf("connected error==%i [%i]\n", iResult,
errno); } /* sleep */ sys_msleep(60000);/*let the time to see if any other packet
is received*/ printf("close now\n"); } /* close the socket */ closesocket(sock); } } } I got : Starting lwIP, loopback interface IP is 127.0.0.1 -4 = ERR_ABRT What I can said is the PC never send any RST packet
(checked with wireshark). Of course, perhaps it's different with another pc OS. But in all cases, in err_tcp, we set to NULL conn->pcb.tcp.
So, we can't reuse the pcb. The only solution seems to close the socket and
reopen it. If on RST, we receive any error, perhaps we could add a line like: static void err_tcp(void *arg, err_t err) { struct netconn *conn; conn
= arg; LWIP_ASSERT("conn != NULL",
(conn != NULL)); if
(conn->pcb.tcp == NULL) return;
/*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ conn->pcb.tcp
= NULL; conn->err
= err; ----- Original Message ----- From: "Jonathan Larmour" <address@hidden> To: " Sent: Tuesday, December 11, 2007 11:45 PM Subject: Re: RE : [lwip-users] Receiving RSTs > address@hidden wrote: |
[Prev in Thread] | Current Thread | [Next in Thread] |