Timeout Disconnect behavior in TCP connection

KevinB
KevinB
edited November 2014 in Native
Hi,

we are experimenting switching from UDP to TCP connection.

During TCP connection, when a disconnection occurred(server detect client timeout), a lot of the times the photon client only detects such disconnection after more than 1 minute. connectionErrorReturn will be called with error code 1039. in UDP case, usually client detect disconnection within 10sec or so.

the way we force disconnection is by unplugging and replugging the ethernet cable from our wireless router multiple times within 2-3 sec(simulate dropping packets intermittently).

we are using photon client iOS 3.0.4.4. Thanks.

K

Comments

  • Hi KevinB.

    This is an issue with TCP itself. Actually 1 minute is an astonishingly short time to detect the connection drop for TCP, as the TCP protocol recommends that a TCP implementation should set such a connection-loss timeout somewhere in the dimensions of many minutes up to multiple hours. Although this is preferable for many usage scenarios of TCP, it is definitely not the kind of behavior, that one normally wants in realtime multiplayer games. Therefor more recent versions of the Photon Client use their own timeout not only for UDP (for which Photon always had it's own timeout ), but also for TCP. This feature has been introduced with version 3.2.5.0, so it is not available in version 3.0.4.4.
    However the TCP implementation in 3.0.4.4 has a couple of known bugs that have been fixed in later versions and in general in the about 2 years since that release we have made quite a couple of improvements, so my recommendation is to update to a more recent version anyway.
  • Thanks for the quick response.

    so updating to the latest Photon client could potentially fix the issue that i encountered?

    would I need to upgrade the server sdk as well? we are using 3.0.37.3631 in the server side.

    and we would be using the Photon-OnPremise-iOS-SDK_v3-2-5-5.zip client SDK which is not the cloud one correct?

    Thanks a lot!

    K
  • Yes, with the latest Photon client version you should not encounter this issue anymore.

    Whatever timeout you set via PhotonPeer::setDisconnectTimeout(), with the latest version it will affect not only UDP, but also TCP connections. The default timeout value, which gets used, if you don't set any value yourself, is 10.000ms (for both, UDP and TCP).
    All Photon 3 client versions are compatible to every Photon 3 server version, so you don't have to update your server.

    Yes, the onPremise SDK is the Photon server variant of the client SDK.
  • Thanks,

    btw, what exactly is Photon v4?

    K
  • Well, it is Photon 4, the Photon 3 successor, of course.

    However, aside from some prereleases of the new Chat-API, only C# Clients of Photon 4 are available at the moment. Photon 4 clients for other programming languages as well as the Photon 4 server are still in the making and new "Photon 4 only" features of the available Photon 4 clients can only be used with Photon cloud at the moment.
  • Hi!
    We have the same issue, as in #1 post. We are using latest Photon SDK 4.0.0.12 and Photon server OnPremise. We are using TCP connection in iOS builds. Steps to reproduce the issue:
    1. Connect to server
    2. Turn Airplane mode on
    3. Return to game
    4. Turn Airplane mode off
    5. Return to game
    Device will never know, that it was disconnected and will not try to reconnect. The same thing can be reproduced by answering the incoming call and returning to game, if you were using cellular network internet connection (3g or 4g).
    Tried to use PhotonPeer::setDisconnectTimeout(), but no luck.
    So the question is the same: how can I detect timeout disconnect on iOS device?
  • Hi @Tenechek.

    Please be aware that this thread is about the Photon Client SDKs for native programming languages (C++ and objective C) as you can see from the fact that it has been posted in the native area of the forum.

    The only Client SDKs for which we have ever released a version 4.0.0.12 are the C# ones. Therefor I assume that you are talking about a C# Client.

    Please note that the feature to support PhotonPeer::setDisconnectTimeout() with TCP has only been implemented in the C++ and objC clients by now, but is currently not available in any other clients, including the C# ones. Therefor what you are experiencing is expected behavior.

    Please do a feature request in the DotNet area of the forum if you are interested in having this feature with the C# clients.
  • Hi @Kaiserludi ,
    Now, Is Photon implement the feature support PhotonPeer::setDisconnectTimeout() with TCP for C# client?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @dzungvd,

    Take a look here.
  • Hi @dzungvd.

    The C# clients support it since version 4.1.1.17, which got released just a couple of minutes ago. In PUN it's supported since 1.86.