lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip tcp hangup


From: Simon Goldschmidt
Subject: Re: [lwip-users] lwip tcp hangup
Date: Thu, 01 Sep 2011 10:49:40 +0200

vincent cui <address@hidden> wrote:
> The following code is a piece of my web server, I think it should deal
> with mult-connetion, but the result is not

That code should be OK to handle parallel connections. If it's not, it could be 
a problem either in how the 'httphandler' function works or how your OS handles 
parallel threads. I'm not familiar with FreeRTOS, however (since I think that's 
what you're using).

Simon

BTW: no need to call close() for invalid sockets (i.e. < 0). Since this is an 
error condition, you should break the while-loop instead.

BTW2: '0' *is* a valid socket, so your check should be 'if (clientfd >= 0)'.

>       while (1) 
>       {
>         clientfd = lwip_accept(lSocket, (struct sockaddr*)&client_addr,
> &addrlen);
>               if (clientfd > 0)
>               {
>                       xTaskCreate( httphandler, NULL, 128, (void *)&clientfd,
> HTTP_TASK_PRIORITY, NULL );
>                       vTaskDelay(100);
>               }
>               else
>               {
>                       lwip_close (clientfd);
>               }
>     }
> 
> Would you help to check ?
> 
> 锘?Vincent Cui
> Sr.Firmware Engineer
> Mobile: +8613482482211
> Tel: +86 21 34612525x6104
> Fax: +86 21 34619770
> E-Mail: address@hidden
> Shanghai EnLogic Electric Technology Co., Ltd.
> Address: 1104-1106, Building A, No.391, Guiping Road, Xuhui District,
> Shanghai, 200233
> http://www.enlogic.com
> 
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf Of Simon
> Goldschmidt
> Sent: 2011年9月1日 16:10
> To: Mailing list for lwIP users
> Subject: Re: [lwip-users] lwip tcp hangup
> 
> vincent cui <address@hidden> wrote:
> > I mean I don't make lwIP do mult connection, it always deal with
> > connection  one by one
> 
> lwIP certainly allows multiple parallel connections, but I don't
> understand what you mean by "making lwIP do mult connection".
> 
> Simon
> -- 
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> 
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de



reply via email to

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