Search Unity

ServerDisconnected due to error: Timeout

Discussion in 'Multiplayer' started by Deleted User, Jun 29, 2017.

  1. Deleted User

    Deleted User

    Guest

    5.6.2 f1.
    ServerDisconnected due to error: Timeout

     
    Last edited by a moderator: Jun 29, 2017
  2. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    :( Don't know - upload project please I will take a look.
     
    Deleted User likes this.
  3. Deleted User

    Deleted User

    Guest

    well, it's simple setup NetworkManager + HUD. Give me a minute.
     
  4. Deleted User

    Deleted User

    Guest

    https://drive.google.com/open?id=0B_mtzyCOVTCdcUVNdjYzTVk0SUk

    Steps:
    1)Start the "scene".
    2)Start a server not host.
    3)Connect from a standalone build to the server, disconnect, connect, disconnect => Timeout Error. The same as on video above.

    Thanks for tracking UNET forum, I appreciate that.
     
  5. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @Wobes "it is not a bug it is feature (TM)" :)
    So, what's happened. When you press stop on client, client sends disconnect AND close socket. unfortunately socket closes faster then disconnect packet get a chance to fire out. Therefore, server doesn't receive any disconnect from the client and close connection by timeout. It is "some sort of mistake" in hlapi. If it important, you can implement disconnect by himself on top of reliable transport.

    Now when your call disconnect, connection will send disconnect packet only once and then will close, (if packet will drop, peer will never get disconnect packet and will disconnect connection by timeout)
    Why we implemented this one. Unfortunately we didn't have any clean decision how disconnect should work, look on questions:
    1. When you call disconnect, what should happen with messages waiting for sending?
    2. With reliable messages waiting for acknowledges?
    3. With message waiting for reading?
    As we didn't have clean answers on these questions we implemented simplest one.. If you have any idea - you are welcome
     
    Deleted User likes this.
  6. Deleted User

    Deleted User

    Guest

    But this error wasn't present on 5.4 version.
     
  7. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Heh, there was a different algorithm, who socket will close after you call RemoveHost(). Before the command to close socket was stored in the command queue, so it took some time before socket was really closed. Some user complained that they cannot call AddHost() immediately after they call RemoveHost(). Now socket is closed immediately after RemoveHost() call. It is the reason.
     
    nxrighthere and Deleted User like this.
  8. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I still think this is a bug and shouldn't happen. I'd rather have a small delay upon socket closing rather than an annoying error and server not knowing that client actually disconnected properly.

    I've also haven't found a way to properly implement disconnect since the last thread.
    @aabramychev, Can you provide a proper example how that should be done? Thanks.
     
  9. shelllee

    shelllee

    Joined:
    Apr 12, 2018
    Posts:
    18
    what about kick a player on server