LWIP - threadsafe

Reiner1210
Posts: 39
Joined: Tue Mar 20, 2018 6:28 pm

LWIP - threadsafe

Postby Reiner1210 » Mon Dec 16, 2019 3:14 pm

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

ESP_Angus
Posts: 2176
Joined: Sun May 08, 2016 4:11 am

Re: LWIP - threadsafe

Postby ESP_Angus » Mon Dec 16, 2019 11:32 pm

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

Reiner1210
Posts: 39
Joined: Tue Mar 20, 2018 6:28 pm

Re: LWIP - threadsafe

Postby Reiner1210 » Tue Dec 17, 2019 1:50 pm

Thanks for the answer.
What should be used:
The lwip function or the "normal" function ?
e.g lwip_accept or only accept ?

ESP_Angus
Posts: 2176
Joined: Sun May 08, 2016 4:11 am

Re: LWIP - threadsafe

Postby ESP_Angus » Tue Dec 17, 2019 10:31 pm

You can use either but we recommend calling the standard functions - ie accept(). But they compile to the same thing.

Who is online

Users browsing this forum: Baidu [Spider] and 38 guests