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).
lwip server stm32f767
- Giovanni
- Site Admin
- Posts: 14563
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1111 times
- Been thanked: 937 times
- Contact:
Re: lwip server stm32f767
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
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
Re: lwip server stm32f767
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.
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.
Who is online
Users browsing this forum: No registered users and 7 guests