Using ConnectToMaster does not join self hosted photon server

I'm using this to connect to the server
PhotonNetwork.GameVersion = "v0.0.1";
PhotonNetwork.ConnectToMaster(IPAddress, 5055, "");

but it disconnects me immediately after trying to join
OnDisconnected was called by PUN with reason DisconnectByServerReasonUnknown
UnityEngine.Debug:LogWarningFormat(String, Object[])
LobbyManager:OnDisconnected(DisconnectCause) (at Assets/Scripts/LobbyManager.cs:108)
Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected(DisconnectCause) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3428)
Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2568)
ExitGames.Client.Photon.<>c__DisplayClass103_0:<EnqueueStatusCallback>b__0()
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:116)
IPAddress is set to the Game Server IP Local address, any help is appreciated!

Best Answer

  • Tobias
    Tobias admin
    Answer ✓
    In PhotonNetwork.ConnectToMaster(), above the SetupLogging() call, add this:
    NetworkingClient.LoadBalancingPeer.SerializationProtocolType = SerializationProtocol.GpBinaryV16;

    This should help. The server from the SDK does not yet support the new/current serialization protocol.
    PUN 2 sets the "old" protocol in ConnectUsingSettings() but not in ConnectToMaster(), which is a problem here.

Answers

  • This is the log from SupportLogger
    [57.33] SupportLogger OnDisconnected(DisconnectByServerReasonUnknown).
    UnityEngine.Debug:Log(Object)
    Photon.Realtime.SupportLogger:OnDisconnected(DisconnectCause) (at Assets/Photon/PhotonRealtime/Code/SupportLogger.cs:216)
    Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected(DisconnectCause) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3428)
    Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2568)
    ExitGames.Client.Photon.<>c__DisplayClass103_0:<EnqueueStatusCallback>b__0()
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:116)
    With another project using the older version of PUN, it can connect to the self hosted server just fine, but not this project which uses PUN 2.
  • Hi, I really need someone to help me(my deadline is next monday plz help), if there's anything that needs to be clarified, I will gladly provide it.
  • Tobias
    Tobias admin
    Answer ✓
    In PhotonNetwork.ConnectToMaster(), above the SetupLogging() call, add this:
    NetworkingClient.LoadBalancingPeer.SerializationProtocolType = SerializationProtocol.GpBinaryV16;

    This should help. The server from the SDK does not yet support the new/current serialization protocol.
    PUN 2 sets the "old" protocol in ConnectUsingSettings() but not in ConnectToMaster(), which is a problem here.
  • Thank you so much! That fixed it! :)