コード例 #1
0
        /// <summary>
        /// socket UDP协议异步接收消息触发事件
        /// </summary>
        /// <param name="ar"></param>
        private void ReceiveDataAsync(IAsyncResult ar)
        {
            int readLength = socket.EndReceiveFrom(ar, ref receveIP);

            Recevier?.Invoke(receiveBuffer, receveIP);
            Array.Clear(receiveBuffer, 0, receiveBuffer.Length);
            socket.BeginReceiveFrom(receiveBuffer, 0, receiveBuffer.Length, SocketFlags.None, ref receveIP, ReceiveDataAsync, null);  //接收完消息后再次进行接收
        }
コード例 #2
0
 public OpenCommand(Recevier recevier)
 {
     _recevier = recevier;
 }
コード例 #3
0
ファイル: OtherCommand.cs プロジェクト: 44r0n/CommandPattern
 public OtherCommand(Recevier recevier)
 {
     _reciever = recevier;
 }