Unable to connect to my own server temporarily

I'm trying to do some stress tests with my self-hosted server. I did not modify anything about the SDK. Everything works on my end until I use an IP for my game server. I'm hosting the server and running the client on the same machine. I can't connect to my own server more than once, but my Amazon EC2 instance can connect to it as many times as it likes. In order for me to play on my own server, I have to wait roughly 15 minutes each time, otherwise it's working fine.

The client behavior on my local machine is
  • Connect to master on my public IP, port 5055, success
  • Connect to game server on my public IP, port 5056, joined room
  • Leave the room and disconnect
  • Connect to master on my public IP, port 5055, success
  • Connect to game server on my public IP, port 5056, timeout
The client behavior on the EC2 instance is the same except it can always join the game server.

On the behavior of the included TestClient, the first half connect. The second half complain about "(Game does not exists)"
On the second run and onward, I think they all fail to connect.
If I wait 15 minutes, I get the behavior of the first run again.

Here are the logs

Comments

  • hi, @RayRay26

    I've checked your logs and do not see there anything. They are useless. Please activate debug logging and repeat what you are doing. To not reveal anything very sensible for you write us to [email protected]

    If that is possible try to move your machine to different network. For instance use mobile connection instead of land one.
    Please collect logs on client machine too. I'm especially interested in what address you got during second connection to master

    best,
    ilya
  • Sent the email containing the new logs. I updated PUN, but I'm still experiencing the same behavior.
  • RayRay26RayRay26
    edited November 23
    I want to add that the examples included with PUN 2.23 have the same behavior. They work fine if I use Photon Cloud, but not my own server. The only thing I modified about the SDK is what debugging level I use.

    EDIT: I'm going to try using my 6 year old laptop. It should be able to run my game. If I don't have any connection issues, I'm going to say there's a loopback issue with Photon Server and the client on the same machine.
  • Okay, I have a workaround! My client connects just fine when it connects to 127.0.0.1 and the server sends 127.0.0.1. I can always connect to the master server this way even when the game is sending the public IP.
    So what I did was I modified Photon Realtime to ignore what the server sends and use 127.0.0.1 for the game server. I added this snippet in PhotonRealtime.LoadBalancingClient:
    string[] masterParts = MasterServerAddress.Split(':');
    string[] addressParts = serverAddress.Split(':');
    if(masterParts[0] == "127.0.0.1")
        serverAddress = "127.0.0.1:" + addressParts[1];
    
    Right before this line:
    bool connecting = this.LoadBalancingPeer.Connect(serverAddress, proxyServerAddress, this.AppId, this.TokenForInit);
    
    This allows clients running on the same machine to connect to the game server as many times as they like. Of course, I'll have to do this each time I update PUN.
  • hi, @RayRay26

    it looks like putting dust under the carpet.

    best,
    ilya
Sign In or Register to comment.