Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

ClientWebSocket connectAsync freezes on 3rd try

Discussion in 'Connected Games' started by BUWbrean, Dec 13, 2017.

  1. BUWbrean

    BUWbrean

    Joined:
    May 4, 2017
    Posts:
    9
    Hi,

    I am currently working on a WebSocket Library that uses the Experimental .Net 4.6 . When I try to connect multiple times to a server that does not exist I get an Exception for the first 2 tries (which is fine so far) but the ConnectAsync freezes on the 3rd try.
    See this gist for example code. The output for this code is this:

    HTML:
    1. try to connect
    Connection Error
    2. try to connect
    Connection Error
    3. try to connect
    The 3rd "Connection Error" is never shown/the task is frozen.
    Any idea how I can solve this? Ideally it would try to connect to the server forever (I could add some delay that increases over time, but in theory I'd like to have a loop until my server becomes available).
     
  2. BUWbrean

    BUWbrean

    Joined:
    May 4, 2017
    Posts:
    9
    I tested a bit more and it looks like it is always the 3rd unsuccessful connection attempt, things like successfully connecting on the 2nd attempt then disconnect and reconnect works. Only 3 unsuccessful connection attempts in a row result in the freeze.

    I assume this might be a .Net-Framework issue, so I also chatted with the microsoft support and created an issue on the MS feeback hub as well as the communty forum.
     
    Last edited: Dec 14, 2017
  3. delphinius81

    delphinius81

    Joined:
    Mar 6, 2012
    Posts:
    47
    Came across this bug as well (spent 2 days trying to figure out why). Seems to be fixed in Unity 2018.