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: vincent cui
Subject: Re: [lwip-users] lwip tcp hangup
Date: Thu, 1 Sep 2011 10:37:15 +0000

I don't use select, but I think it should works too 

        lSocket = lwip_socket(AF_INET, SOCK_STREAM, 0);
        if (lSocket < 0) 
        {
                return;
        }

        memset((char *)&sLocalAddr, 0, sizeof(sLocalAddr));
        sLocalAddr.sin_family = AF_INET;
        sLocalAddr.sin_len = sizeof(sLocalAddr);
        sLocalAddr.sin_addr.s_addr = htonl(INADDR_ANY);
        sLocalAddr.sin_port = htons(80);

        if (lwip_bind(lSocket, (struct sockaddr *)&sLocalAddr, 
sizeof(sLocalAddr)) < 0) 
        {
        lwip_close(lSocket);
        return;
        }

        if ( lwip_listen(lSocket, 20) != 0 )
        {
        lwip_close(lSocket);
        return;
        }

        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);
                }
    }

锘?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 FreeRTOS Info
Sent: 2011年9月1日 18:36
To: Mailing list for lwIP users
Subject: Re: [lwip-users] lwip tcp hangup

Maybe the best thing to do is try and work out why it is not currently
working as intended, rather than to work out a workaround to a problem
that should not exist.

What is the problem?  Is it that the select() statement is misbehaving,
and so returning unnecessarily, and therefore using up processing
resources.  Or is it that select is returning invalid data, and hence
using up too many resources.  Or is it something else entirely?


Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers.
More than 7000 downloads per month.




On 01/09/2011 10:36, Simon Goldschmidt wrote:
> FreeRTOS Info <address@hidden> wrote:
>> Presumably accept() will keep the task in the Blocked state (i.e. not
>> using any CPU time) until there is something to accept.  This is the
>> intended usage model when using any kernel, be it FreeRTOS or otherwise,
>> isn't it?
> 
> Yep, it is. I don't understand it either, I just assumed that this was to 
> prevent the webserver eating up too many resources...
> 
> Simon

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

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