I want to create a process running under linux that creates multiple threads, each thread writing their own data out to a receiving process over a UDP socket connection. For sizing, say I need to have up to one hundred of these threads all running simultaneously with threads coming and going.
Is it better to have each thread open up it's own socket to the same destination using the same UDP port number when the thread is created (thus needing 100 separate file descriptors) or to open the socket one time in the main thread and pass that file descriptor to each of the threads so it each uses the same socket? Each thread will be generating about 20 packets per second, each packet roughly 800 bytes in length. There is no synchronization between threads.