[Unity] if you exit the program, the port will not close and will be occupied. #29
-
You need to add |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Can Netly automatically handle this issue?No!
UdpServer.csnamespace Netly
{
public class UdpServer
{
public UdpServer(bool useConnection, int timeout = 10000)
{
#if UNITY_ENGINE
UnityEngine.Application.quitting += this.Close();
#endif
}
}
} Netly Code.
|
Beta Was this translation helpful? Give feedback.
Can Netly automatically handle this issue?
No!
OnApplicationQuit() => server.Close();
is only available toMonoBehaviour
children. The another way is usingApplication.quitting += server.Close()
UdpServer.cs
Netly Code.
Easy way