Ejemplo n.º 1
0
 public USocket(Action <BufferEntity> dispatchNetEvent)
 {
     udpClient = new UdpClient(0);
     server    = new IPEndPoint(IPAddress.Parse(ip), port);
     local     = new UClient(this, server, 0, 0, 0, dispatchNetEvent);
     ReceiveTask();//接收消息
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 关闭udpClient
        /// </summary>
        public void Close()
        {
            if (local != null)
            {
                local = null;
            }

            if (udpClient != null)
            {
                udpClient.Close();
                udpClient = null;
            }
        }