When to use blocking sockets over non blocking sockets on UDP?
Question 1:What's is recommended for the following scenario ?
Multiple clients send data over multiple UDP sockets, i.e. say client1 sends data over sockets 100, 101, 102,..,105 . client2 on sockets 110,111,112...115 etc. Port numbers are fixed for clients. Number of clients are fixed(10). So totally 10 * 5 sockets.
Data on each sockets(atleast 3 sockets) is sent every few milliseconds. The other 2 sockets are for sending commands and getting data.
After receiving the data there is some IO involved where i write to disks. (I cant change any of the above. i.e. number of sockets ,etc )
Question 2:Is it best to use Threads for this scenario (or) Asynchronous IO multiplexing with nonblocking sockets?
select()
to read from any socket, then dispatch to a thread.