lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] socket: LWIP_ACCEPT problem?


From: Bikram Chatterjee
Subject: Re: [lwip-users] socket: LWIP_ACCEPT problem?
Date: Thu, 6 Mar 2008 00:07:43 +0530

> I have a simple client on pc running windows.
>
> If the client fixs his local port, accept function accept connection only the 
> first time, after seems it doesn't accept.
>
> If my client changes its local port for EVERY attempt, accept works weel!!!
>
> What is the problem???

A TCP connection is uniquely identified by six tuple at any end point
(src_addr, src_port, dst_addr, dst_port). You see that in your case
none of the parameters in the tuple has changed in the second
connection. So the stack has no way of separating packets from this
new connection from that of the previous one.

Are you sure that the second connection actually have originated from
the client? The stack on your client m/c should have stopped it.

Bikram

On Wed, Mar 5, 2008 at 10:12 PM, Bill Auerbach
<address@hidden> wrote:
>
>
>
>
> I wrote that because for me the client (Win32) wouldn't reopen the port if I 
> clicked Close and then Open in my program.  Setting SO_LINGER resolved this.  
> You didn't mention your client, so I guessed (wrong).
>
>
>
> How to fix from lwIP?  Nothing you've written indicates it is lwIP, 
> especially if a 3rd party client works.
>
>
>
> Bill
>
>
>
>
> ________________________________

>
> From: address@hidden [mailto:address@hidden On Behalf Of Piero 74
> Sent: Wednesday, March 05, 2008 10:47 AM
>
> To: Mailing list for lwIP users
> Subject: Re: [lwip-users] socket: LWIP_ACCEPT problem?
>
>
>
>
>
>
> Now i'm using a simple client which i wrote....
> By my board will work with a third part client, so, i cannot know if this pc 
> application will set SO_LINGER.
>
> So, how i can fix the problem from lwip code???
>
> thanks,
> Piero
>
>
> 2008/3/5, Bill Auerbach <address@hidden>:
>
>
>
> Change the client's SO_LINGER option so it doesn't hang on to the connection.
>
>
>
> Bill
>
>
>
>
> ________________________________

>
> From: address@hidden [mailto:address@hidden On Behalf Of Piero 74
> Sent: Wednesday, March 05, 2008 10:14 AM
> To: Mailing list for lwIP users
> Subject: [lwip-users] socket: LWIP_ACCEPT problem?
>
>
>
>
> Hi all.
>
> I'm testing socket on lwip 130rc1
>
> this is a piece of my code:
>
>   // Create a new tcp connection handle
>   //----------------------------------------------------------
>   sockfd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
>   serv_addr.sin_family = AF_INET;
>   serv_addr.sin_addr.s_addr = INADDR_ANY;
>   serv_addr.sin_port = htons(20000);
>   bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr));
>   //    setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (char*)&bOptVal, 
> bOptLen);
>   listen(sockfd, 0);
>   //----------------------------------------------------------
>
>   // Loop forever
>   while(1)
>   {
>     // Wait for connection.
>     //------------------------------------------------------
>     newsockfd = accept(sockfd, &addr, &addrlen);
>     bOptVal = TRUE;
>     //------------------------------------------------------
>     for (i=0; i<10; i++)
>     {
>       // send 10 hello world!
>       lwip_write(newsockfd, provatx, 12);
>     }
>
>     // close connection
>     close(newsockfd);
>   }
>
> I have a simple client on pc running windows.
>
> If the client fixs his local port, accept function accept connection only the 
> first time, after seems it doesn't accept.
>
> If my client changes its local port for EVERY attempt, accept works weel!!!
>
> What is the problem???
>
> bye,
> Piero
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]