Not connecting Photon Master server

Hi Guys, We have integrated the photon and has 100CCU plan. Recently game is not connecting to mast server more frequently. Its not giving call back "public virtual void OnConnectedToMaster()" in failure scenario. Could you please help us in tracking this issue.

Below are the Photon game settings in our game for your reference.

Protocol selected -- Tcp
        PhotonNetwork.autoJoinLobby = false;   
        gameObject.AddComponent();
        PhotonNetwork.networkingPeer.DisconnectTimeout = 30000;
        PhotonNetwork.networkingPeer.SentCountAllowance = 10;
        PhotonNetwork.networkingPeer.QuickResendAttempts = 4;

        PhotonNetwork.ConnectToRegion(CloudRegionCode.us,"1.0");

Comments

  • edited January 30
    Some times we are getting this exceptions:
    System.Net.Sockets.SocketException (0x80004005): interrupted
    at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000b6] in :0
    at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, System.Int32 port) [0x00008] in :0
    at ExitGames.Client.Photon.SocketTcp.DnsAndConnect () [0x00088] in <5bac2b0d73684de1adac4ad02bdde90d>:0
    UnityEngine.Debug:LogError(Object)
    NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1574)
    ExitGames.Client.Photon.SocketTcp:DnsAndConnect()
    System.Threading.ThreadHelper:ThreadStart()
  • @JohnTube The above question modified a bit and added every thing at one place. Please respond to only this. Sorry for inconvenience.

    Recently game is not connecting to mast server more frequently. Its not giving any call backs on calling PhotonNetwork.ConnectToRegion(CloudRegionCode.us,"1.0");

    It should atleast call either of the below callbacks.
    "public virtual void OnConnectedToMaster()"
    “public virtual void OnFailedToConnectToPhoton(DisconnectCause cause)”

    Could you please help us in tracking this issue.

    Below are the Photon game settings in our game for your reference.

    Unity version: 2018.2.20f1
    Photon version: v1.91 (6. July 2018)
 Protocol selected -- Tcp
    PhotonNetwork.autoJoinLobby = false;
    gameObject.AddComponent();
    PhotonNetwork.networkingPeer.DisconnectTimeout = 30000;
    PhotonNetwork.networkingPeer.SentCountAllowance = 10;
    PhotonNetwork.networkingPeer.QuickResendAttempts = 4;
    PhotonNetwork.ConnectToRegion(CloudRegionCode.us,"1.0");


    Note : Most of the times Its working fine with few Networks but with some specific networks its failing 50% of times.

    Also we are getting below null ref error some times.

    System.Net.Sockets.SocketException (0x80004005): interrupted
    at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000b6] in :0
    at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, System.Int32 port) [0x00008] in :0
    at ExitGames.Client.Photon.SocketTcp.DnsAndConnect () [0x00088] in <5bac2b0d73684de1adac4ad02bdde90d>:0
    UnityEngine.Debug:LogError(Object)
    NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1574)
    ExitGames.Client.Photon.SocketTcp:DnsAndConnect()
    System.Threading.ThreadHelper:ThreadStart()
  • JohnTubeJohnTube mod
    edited February 4
    Hi @Maheshk_218,

    The error you provided is not a NullReferenceException but probably a socket exception should trigger OnFailedToConnectToPhoton, did you check if it triggers OnDisconnected callback?
    We will investigate.

    What .Net version and scripting backend do you use in Unity?
    Does this happen in the Unity Editor or in a build?
    What is the target platform?

    Does this happen with our demo scenes?
    What happens if you switch to UDP?
    Did you try another Unity version?
    Did you try updating PUN? the latest is 1.93 I believe...

    with some specific networks
    Could you tell us more about this specific network? maybe it's unstable?
  • @JohnTube
    Here is the details that you requested :smile:
    .Net version ---- .Net 4.x
    scripting backend --- IL2CPP
    Does this happen in the Unity Editor or in a build? --- Its happening in both devices and Unity editor.
    What is the target platform? : Both iOS and Android
    Does this happen with our demo scenes? — Yes
    What happens if you switch to UDP? — With UDP every thing Working fine, no issues
    Did you try another Unity version? — nope
    Did you try updating PUN? the latest is 1.93 I believe... Not updated
    Could you tell us more about this specific network? maybe it's unstable?— Its only on office Wifi. Others networks are working fine.
  • You should update. The .Net 4.x scripting backend has a few, nasty issues with the Socket classes and we tried to work around those in newer PUN versions. 1.93 is currently available and should be used.
  • Yes , I have updated to latest version now. Please help me with one more issue.
    This issues is happening in android only.

    When android device went to background then calling PhotonNetwrok. Disconnect. and when launching back calling PhotonNetwork.ReconnectAndRejoin also calling Reconnect and Rejoin independently if needed. But I am getting below errors.
    1. Connect() failed. Can't connect while disconnecting (still). Current state: Disconnecting
    2. ReJoinRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.

    The same thing is working fine in iOS device.
    Here is the Room Settings
    roomOptions.MaxPlayers = 2;
    roomOptions.PlayerTtl = 27000;
    roomOptions.EmptyRoomTtl = 27000;
    roomOptions.IsVisible = false;
    roomOptions.IsOpen = true;

Sign In or Register to comment.