Search Unity

  1. Unity 2019.1 beta is now available.
    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. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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:
    51
    Came across this bug as well (spent 2 days trying to figure out why). Seems to be fixed in Unity 2018.