Forum Discussion
Altera_Forum
Honored Contributor
13 years agoWhat you need in this case is to call accept() in your Nios application again, even when the socket isn't closed.
Typically this could be done with multithreading. Each time accept() returns, you create a new thread to answer on the created socket, and then immediately call back accept() in the main thread. The main problem is that resource usage will increase each time a new connection is made, so you should find a way to close unused sockets and kill their respective threads. It is also possible to do it in a single thread by using select() to listen on several sockets and accepting new connections simultaneously. But in my experience select() doesn't work very well with ucOS II and the Interniche TCP/IP stack.