Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Resolved] New Transport Layer API - increase time before client timeout/disconnect?

Discussion in 'Multiplayer' started by ldonelan98, Feb 24, 2020.

  1. ldonelan98

    ldonelan98

    Joined:
    May 11, 2018
    Posts:
    2
    Hello,

    I can't figure out how to increase the time before a client times out and disconnects from the server when using the new Transport Layer API (Unity.Networking.Transport). I checked the documentation and did some google searching to no success.

    If my clients are inactive for a couple of minutes (maybe less?) they are disconnected by the server. Otherwise, everything is working fine.

    If this sounds like an implementation error I can share my server/client code.

    Currently I am working around the issue by making the clients reconnect to the server if it sends them a disconnect event.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I haven't used the new transport, but you should check if Unity has implemented automatic keep alive messages. If not you need to implement them because typical consumer NAT enabled routers will often default to dropping UDP "connections" from their translation table at about 30 seconds of inactivity, sometimes as short as 10 seconds. I recommend sending a keep alive message every 3 seconds to allow for a couple dropped packets not resulting in a dropped connection.

    Once you're dropped from the router's translation table, any packets you receive will be dropped by the router instead of forwarded. If you're just testing locally and getting dropped by the transport itself, keep alives will probably take care of that issue as well.
     
    Last edited: Feb 24, 2020
    ldonelan98 likes this.
  3. ldonelan98

    ldonelan98

    Joined:
    May 11, 2018
    Posts:
    2
    Ah, that sounds like what I'm looking for. Thank you :)
     
    Joe-Censored likes this.