lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] TCP socket thread safety


From: Shaun Crampton
Subject: Re: [lwip-users] TCP socket thread safety
Date: Tue, 12 Feb 2013 17:02:40 +0000
User-agent: Microsoft-MacOutlook/14.3.0.121105

Thanks for the quick response.

Duplex communication is pretty important for my application.  Is there a
way to do it with one of the other APIs (e.g. the raw API)?

On 11/02/2013 23:09, "Simon Goldschmidt" <address@hidden> wrote:

>Shaun Crampton wrote:
>> I'm looking at lwIP for a new project and I'm trying to understand the
>> threading model for the socket-alike API.  Assuming I'm on a preemptive
>>OS
>> (Linux), is it safe to
>> 
>>   *   concurrently create multiple sockets in different threads
>
>Yes.
>
>>   *   for one single socket, call send in one thread and recv in another
>> thread (to enable duplex communication).
>
>No.
>
>> If it's not possible to do duplex communication in that way, is there a
>> way to do it?
>> 
>> If I've read the docs correctly, then I think it's up to my application
>>to
>> stop all threads using the socket before closing it, which is fair
>>enough.
>
>That way it would work, but it's not real full duplex then. It's quite
>hard to make a thread return from recv() once it's blocked there waiting
>for new data... You can always use select(), but there's no easy way
>(other than a loopback socket) to make select() return by application
>software if you're not using a timeout...
>
>
>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]