Page 1 of 1

LWIP - threadsafe

Posted: Mon Dec 16, 2019 3:14 pm
by Reiner1210
Hello,

If I have a server application I get a socket via accept.
Is it now possible to use 2 thread which use this socket ?
One thread will read from the socket and the other one will write to this socket.

Thanks for your help
Reiner

Re: LWIP - threadsafe

Posted: Mon Dec 16, 2019 11:32 pm
by ESP_Angus
Hi Reinier,

Yes, this is supported and should work as expected.

It's even possible to close the socket while another task is blocking on read/write: https://docs.espressif.com/projects/esp ... fe-sockets

Angus

Re: LWIP - threadsafe

Posted: Tue Dec 17, 2019 1:50 pm
by Reiner1210
Thanks for the answer.
What should be used:
The lwip function or the "normal" function ?
e.g lwip_accept or only accept ?

Re: LWIP - threadsafe

Posted: Tue Dec 17, 2019 10:31 pm
by ESP_Angus
You can use either but we recommend calling the standard functions - ie accept(). But they compile to the same thing.