I was looking for this information and could not find it elsewhere: I am building a multiplayer game with a server and a fixed number of clients. Our clients are multithreaded (one thread for the game logic and visualization, one thread for receiving messages) and may receive messages from the server asynchronously. Communication is acheived using UDP.
What happens if the former thread makes a call to the socket.receive() method while the latter thread goes through a loop that uses socket.receive() as well?
More specifically, if a message arrives from the server and two threads are waiting for reception at the same time, is the message received for both threads? If not, is it defined which thread will receive the packet?
Note that both threads are using the same socket.