Handling multiple UDP sockets
My Qt applications typically listen on several UDP sockets. Is it better to have a thread for each socket, or to have a single thread that does a select() on a fd_set of several sockets? Both approaches work, but I don't know which is more efficient.
Re: Handling multiple UDP sockets
There is no one proper answer to that question. select() in a single thread should be fine and in most cases more efficient than using multiple threads. Especially if processing time of the data received from the socket is short.
Re: Handling multiple UDP sockets
Each approach has its qualities and defects. The select one has speed but isi s more complex to program and have a hardcoded limit to how many sockets it can handle each time (the fd_set struct size).
I suggest you to look the "Unix Network Programming 3rd" book and accord with yout project choose the more suitable one.