コード例 #1
0
 public WriteBufferHandle(byte[] value) : base(value)
 {
     if (TryValid(value))
     {
         buffer = HandleManager.ByteToBuffer(value, Used);
     }
 }
コード例 #2
0
 public RequestDataHandle(byte[] value = null) : base(value)
 {
     if (TryValid(value))
     {
         request = HandleManager.ByteToRequest(value, Used);
     }
 }
コード例 #3
0
        public UdpPoint(int port = 0, bool isThread = true)
        {
            receiveDone = new ManualResetEvent(false);
            isClose     = false;
            Client      = new UdpClient(port);
            //Client.MulticastLoopback = true;
            m_localEndPoint = new IPEndPoint(UdpConfig.LocalIP, ((IPEndPoint)Client.Client.LocalEndPoint).Port);
            Iar             = Client.BeginReceive(ReceiveCallback, this);
            //ReplyList = new List<byte>();

            //RetryDic = new Dictionary<IPEndPoint, List<byte>>();
            //RequestSendDic = new ConcurrentDictionary<IPEndPoint, List<Request>>();
            //HandleSendDic = new ConcurrentDictionary<IPEndPoint, List<BaseHandle>>();
            NetTaskDic = new ConcurrentDictionary <IPEndPoint, NetTask>();
            RequestDic = new ConcurrentDictionary <int, Request>();
            NetstatDic = new ConcurrentDictionary <IPEndPoint, Netstat>();
            //RetryDic = new ConcurrentDictionary<int, int>();

            Mgr       = new HandleManager(this);
            udpThread = new Thread(UdpThread);
            if (isThread)
            {
                udpThread.Start();
            }
            udpReceiveThread = new Thread(UdpReceiveThread);
            Console.WriteLine("UDP线程启动");
        }