Disconnecting when join or create a room

Options

When i try to join or create a room , the client will get disconnected.

I used PhotonNetwork.JoinOrCreateRoom and the return was true, but no callback was called.

This is the log message:

  private void Start()

  {

    if (DebugMode)

    {

      roomName = "Debug";

      Initialize();

    }

  }

  public void Initialize()

  {

    PhotonNetwork.ConnectUsingSettings();

  }

  public override void OnConnectedToMaster()

  {

    Debug.Log("ConnectedToMaster");

    PhotonNetwork.JoinLobby();

  }

  public override void OnJoinedLobby()

  {

    Debug.Log("JoinedLobby");

    CreateOrJoinRoom();

  }

  public void CreateOrJoinRoom()

  {

    RoomOptions options = new RoomOptions { MaxPlayers = 2 };

    Debug.Log("CreateOrJoinRoom");

    bool a = PhotonNetwork.JoinOrCreateRoom(roomName, options, default);

    Debug.Log(a);

  }

  public override void OnJoinedRoom()

  {

    Debug.Log("JoinedRoom");

    PhotonNetwork.Instantiate(player.name, Vector3.zero, Quaternion.identity);

  }

  public override void OnCreatedRoom()

  {

    Debug.Log("CreatedRoom");

  }

  public override void OnCreateRoomFailed(short returnCode, string message)

  {

    Debug.Log("CreateRoomFailed");

    Debug.Log(returnCode);

    Debug.Log(message);

  }

  public override void OnJoinRoomFailed(short returnCode, string message)

  {

    Debug.Log("JoinRoomFailed");

    Debug.Log(returnCode);

    Debug.Log(message);

  }

Answers

  • Tobias
    Options

    Those logs are for Photon Voice, not PUN. For some reason, the Voice client gets disconnected.

    Maybe you are not using the correct AppId for it. The type of the Voice app should be "Voice" and if it's Fusion (e.g.) this would disconnect you.

  • WanChen
    WanChen
    edited December 2022
    Options

    I found the problem. The time-out leads to the disconnect. How can i solve it?

  • Tobias
    Options

    It looks as if your client is not receiving anything.

    Check your firewall if it blocks the port (the log should contain the IP and port, too). Also try the alternative ports. Check if your antivirus or ISP randomly have one of our IPs on their block lists (this happened earlier but it's impossible for us to check or prevent this).