This document is about: SERVER 5
SWITCH TO

Debugging

Disabling Timeouts For Debugging

When you attempt to debug clients and the Photon server, you will run into timeouts unless you're quick. When you pause an application, the other side will start missing replies and disconnect.

When you need to debug using the Photon Server, there is one workaround for this:

Switch The Protocol In Your Client To TCP

In PUN, switching to TCP is done in "PhotonServerSettings" in the Inspector. Set hosting to "Self Hosted", enter your IP (or address) and select protocol TCP from the dropdown. Use ConnectUsingSettings() as usual.

In PhotonServer.config, disable the timeout

Set the InactivityTimeout="0" on ALL relevant "TcpListeners", like this:

XML

    <TCPListener
        IPAddress="0.0.0.0"
        Port="4530"
        InactivityTimeout="0">
    </TCPListener>

"0" value means no timeout. You can set any other high value - note that the "InactivityTimeout" is in milliseconds.

Set The Client Timeout

In PUN 2 clients, set:

C#

    PhotonNetwork.NetworkingClient.LoadBalancingPeer.DisconnectTimeout = 30000; // in milliseconds. any high value for debug

In PUN Classic clients, set:

C#

    PhotonNetwork.networkingPeer.DisconnectTimeout = 30000; // in milliseconds. any high value for debug

In C# clients, set:

C#

    // in a LoadBalancingClient instance:
    this.loadBalancingPeer.DisconnectTimeout = 30000; // in milliseconds. any high value for debug

Make sure to reset the values before you release.
Default client disconnect timeout value is 10000 milliseconds.

Back to top