Beispiel #1
0
    // 通信終了
    public void EndSocket()
    {
        Debug.Log("End");

        if (isRunningWork)
        {
            isRunningWork = false;

            if (isServer)
            {
                UdpDataClient udp = new UdpDataClient(false);

                udp.Send("Quit");

                udp.EndSocket();
            }
            else
            {
                runWorkThread.Join();
            }
        }
        if (sock != null)
        {
            sock.Shutdown(SocketShutdown.Both);
            sock.Close();
        }
    }
Beispiel #2
0
 public void OnApplicationQuit()
 {
     if (udp != null)
     {
         udp.EndSocket();
     }
 }