Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. 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:
    44
    Came across this bug as well (spent 2 days trying to figure out why). Seems to be fixed in Unity 2018.