Socket: Cannot receive, error: Socket is not connected(57)

My app crashed on ios when i resume from suspend ( let it run in the background for 40 seconds and then reactivated).
I connect the device to Xcode and I saw that crash happening after the message beow appears more than 100 times in the logs

Socket: Cannot receive, error: Socket is not connected(57)
(Filename: Line: 475)

I have this issue right now.
The biggest problem problem that I don’t even know which method causes this.

I though it was from NetworkTransport.Receive, but according to my logs it’s not.

Hi, same problem here, on IOS when the connection client/server is done, if I put the client device in suspend mode for some sec. and reactivate it, I’ve no possibility to reconnect to the server…(the error is the same Socket: Cannot receive, error: Socket is not connected(57))
I have to close the App and restart it, and the client reconnect again. But I don’t want to shout down the app because I use the client in Kiosk mode.

Does someone solved it?

Need a possible solution very urgent, please help.

Thanks

Hi,

I have this problem as well. I’m using Unity 5.2.3p3 and building for iOS. Have anyone managed to find a fix or workaround?

Thanks a lot in advance.

Kind regards,
Uffe Flarup

Bump, so reason behind this is because NetworkClient connection is not closed up completely, and there are couple things you can do to fix this i guess…

  1. Under Connected status: you will need to disconnect your network before app go into suspending mode, so simply use OnApplicationFocus(bool pause), and when is going to pause simply use NetworkClient.Disconnect(), and when it comes back up, simply call NetworkClient.Connect().

  2. Under Connecting Status: this is something I am still trying to figure out, while connecting, I do the samething above(but not calling NetworkClient.Conect() when coming back from suspend mode). The status will simply change from disconnected to reconnecting… which I somehow find it hard to believe… to find status of your NetworkClient.cs the easy way: simply create a script that inherit NetworkClient.cs , I called it StupidUnityBugFixNetworkClient.cs, then revealed their protected status variable.