I used UNet to create a very simple client-server application. The client sends a message to the server and the server responds. I successfully tested this by running the client and server on my local machine. I want to test this on multiple machines (i.e., run the server on one machine and run the client on another machine). What is the best way to do this?
I know this is a bit of a dumb question, but I can’t find any information online. Google is flooded with tutorials and forums about building multiplayer games or testing them on your local machine, but I can’t find anything that answers my question.
Are all the machines on your local network? If so, start the server with it’s local network IP address, and make all the clients point to it. Don’t forget to ensure that the server has access through the firewall.
You do it identical to running on the same machine. The only difference is on the client you provide the server’s IP address instead of the loopback address, and you add the complexity of dealing with software firewalls. On Windows for example, the first time you run the server build you will be asked a question regarding the software firewall allowing networking connections to it. It is important you allow that, or you’re going to have to later dig through the firewall settings and fix that before a client can access the server.
If both computers aren’t on the same local network, you will need to use port forwarding on the server’s router, and the client will need to use the router’s internet facing IP address.