lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip complex example


From: Jan Menzel
Subject: Re: [lwip-users] lwip complex example
Date: Wed, 5 Jul 2017 09:39:03 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

Hi Max!
        Sockets are to my understanding thread safe (as well as netconn api) as
both are designed to be used from different threads. lwips internal
functions like raw api are not thread safe and may only be used within
lwips main thread. To use this functions from different threads anyhow,
lwip provides tcpip_callback() which generates a work item that is send
to lwips main task for execution. If you check the code of the socket
(netconn) api, you'll find, that it basically makes use of this feature.
        I personally have not used more then one socket in parallel but aside
from that I don't see a reason why it should not work (again, suppose
you can provide sufficient resources).
        However there is one limitation I came across in 1.4.1: a single socket
may not be used from more the one thread. In 2.0.x the option
NETCONN_FULLDUPLEX was added which seems to provide this feature.

        Jan

On 05.07.2017 8:41, massimiliano cialdi wrote:
> Ok but I wonder how to implement two sockets, because reading txt
> documentation provided it seems that only a subset of api are thread
> safe, and I use LWIP + FreeRTOS.
> 
> So I wonder if I can do this with two threads or I have to do with just
> one.
> 
> I have other doubts about initialization
> 
> 
> best regards
> 
> Max
> 
> On 04/07/2017 17:53, Jan Menzel wrote:
>> Hi Max!
>>     It's the nature of the stack that you may combine any examples you
>> like
>> suppose you can provide sufficient resources. Running eg. http and sntp
>> is quite easy you just need more udp pcbs for sntp and/or tcp support
>> for http...
>>
> 
> 
> _______________________________________________
> 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]