Hello, I had a problem with my multiplayer game, when I execute game in my Android phone and my computer and connect them in the server, just I can see one player, my question is: Why does this happen in my game and how can I solve it?
This seems low your access to that port may be blocked. You need to use a port above 1024.
This will only allow clients to connect if they are on the same machine. The remote client needs to know your your host’s ip address in order to connect.
You should add a text field to the UI to type an IP before the client presses join.
When you create host you don’t provide an IP. This is because it will bind to all network interfaces. It doesn’t matter what the IP is as it isn’t important or used. Only the port matters on the host. The host is ready to accept connections of clients. There will be a handshake behind the scenes when a client connects, that will happen automatically, and will get the clients IP.
Only the client needs to know the IP, and port, of the host.
You don’t, you just need one IP, the server’s. Every client will use the same server IP.
server/host ip = 1.2.3.4 port 5555
client1 connect to 1.2.3.4 on port 5555
client2 connect to 1.2.3.4 on port 5555
client3 connect to 1.2.3.4 on port 5555
...
Is to say, I must use these data or just is example? I think that should create my own IP for this server. In addition, I had the same problem, my devices doesn’t connect them to play the game
You will be assigned an IP address by your router. It will usually start with 192.168.x.x you will have different IP adresses for each device. On your computer, if windows, run ipconfig; mac/linux ip addr. this will tell you what your computer’s IP address is. You will use this information on your phone to connect to your computer’s game, but your program needs to support typing in an IP address via a LineEditr or TextEdit node.