Hello
I'm starting a TNet server inside a Unity Editor Extension. This works fine but in rare cases Unity crashes and the Sockets that I created are still running in the background although the host Process (Unity) has been closed.
If I restart Unity, the same port can no longer be used, because it's blocked by this ghost process. In TCPView i can see the following (see attachment). The PID's do not exist in Task Manager or Process Explorer and they cannot be killed inside TCPView. They are never removed or closed, only after a restart of windows.
I tried reusing the Socket with
mSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true )
This way I can reuse the port, but a new socket is created and the ghost processes still exist. If i try to connect from a client, it is not guaranteed to work since he might connect to the ghost process resulting in no connection.
Did you every encounter something like this? I was using TNet 1.6.6 and just upgraded to the lastest version but since it's hard to reproduce i cannot really tell if this is fixed, have you made any changes in this regards.
I would have thought that the Threads created by TNet (or any Unity Extension) are closed even if Unity crashes, but they are still running or at least the sockets are still listening.
I'm stuck on this issue and it breaks the functionality of my application, so any help is appreciated. I also understand that this might not be a TNet issue, but rather windows/mono/unity. Perhaps there's a workaround to gracefully handle this situation.
Thanks.