lwip server stm32f767

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
Vitaly_Parkhomenko
Posts: 1
Joined: Fri Aug 04, 2023 7:52 pm

lwip server stm32f767

Postby Vitaly_Parkhomenko » Fri Aug 04, 2023 8:43 pm

Hello everyone! I am trying to create tcp server using lwip library on stm32f767.
I want my server to support multiple connections simultaneously. Is there the best way to do this? Right now i am thinking about 1 static thread for netconn_listen() and new dynamic thread for every connection(after closing connetcion dynamic thread will be deleted).

User avatar
Giovanni
Site Admin
Posts: 14402
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1066 times
Been thanked: 912 times
Contact:

Re: lwip server stm32f767

Postby Giovanni » Fri Aug 04, 2023 9:16 pm

Hi,

I don't have an example, if I remember well there were user projects in this forum, try a search.

In principle having a thread for each request would be ideal, you could have a pool of ready threads for servicing without having to create/exit continuously.

Giovanni

steved
Posts: 823
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: lwip server stm32f767

Postby steved » Sat Aug 05, 2023 9:35 pm

Depends a bit on the expected nature of network comms.including the number of simultaneous connections needed, and what you need to do.

For example, I have a network task where multiple remote hosts may initiate a connection to my system, always on the same port number, and all connections needing the same handling. There is a maximum number of simultaneous connections allowed (generally 6-10). So I have a single handler, with a single listener socket passing incoming 'open connection' requests to a new socket, until the limit is reached (all pretty standard network stuff). Then use select() to identify sockets with activity.

For the rest, I find that 'socket per thread' falls out of the code structure, since I tend to have a thread (sometimes two) dedicated to each task.


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 8 guests