I have a server application, part of its code like this:
socket = socket(...); // create a socket
setsockopt(RE_USEADDR); // set the socket option RE_USEADDR
bind(socket, 127.0.0.1, 8080); // bind the socket to the IP address and Port
listen(); // listen
Here is the question:
- I launch the server application twice, on the same machine, same user. Both of them can work well.
- Launch the client application, which connects to
127.0.0.1:8080
- Send some contents to the server. However only one of the server application can receive the message from client.
Is there anyway to make sure the two server applications all receive the message from client. If there is, please explain how and why in TCP and UDP.
Thank you very much