Esempio n. 1
0
 void sendCallBack(IAsyncResult ar)
 {
     //送信終了
     System.Net.Sockets.UdpClient client = (System.Net.Sockets.UdpClient)ar.AsyncState;
     try
     {
         client.EndSend(ar);
     }
     catch (Exception ex)
     {
         Console.Write(ex.Message);
     }
 }
Esempio n. 2
0
 void AccesSsendCallBack(IAsyncResult ar)
 {
     System.Net.Sockets.UdpClient client = (System.Net.Sockets.UdpClient)ar.AsyncState;
     //送信終了
     try
     {
         client.EndSend(ar);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error:callback");
     }
 }
Esempio n. 3
0
        private void OnMessageSent(IAsyncResult result)
        {
            udpClient.EndSend(result);

            if (messageSendQueue.Count == 0)
            {
                isSendingMessage = false;
                return;
            }

            byte[] nextMessage = messageSendQueue.Dequeue();
            udpClient.BeginSend(nextMessage, nextMessage.Length, ipEndpoint, OnMessageSent, null);
        }
Esempio n. 4
0
 public static void udp_send_callback(IAsyncResult ar)
 {
     System.Net.Sockets.UdpClient udp = (System.Net.Sockets.UdpClient)ar.AsyncState;
     // 送信終了
     try
     {
         udp.EndSend(ar);
     }
     catch (System.Net.Sockets.SocketException ex)
     {
         Console.WriteLine("udp send error({0}/{1})", ex.Message, ex.ErrorCode);
     }
     catch (ObjectDisposedException ex)
     {
         Console.WriteLine("udp has closed({0})", ex.Message);
     }
 }
Esempio n. 5
0
        //データを送信した時
        private void SendCallback(IAsyncResult ar)
        {
            System.Net.Sockets.UdpClient udp =
                (System.Net.Sockets.UdpClient)ar.AsyncState;

            //非同期送信を終了する
            try
            {
                udp.EndSend(ar);
            }
            catch (System.Net.Sockets.SocketException ex)
            {
                Console.WriteLine("送信エラー({0}/{1})",
                                  ex.Message, ex.ErrorCode);
            }
            catch (ObjectDisposedException ex)
            {
                //すでに閉じている時は終了
                Console.WriteLine("Socketは閉じられています。");
            }
        }
Esempio n. 6
0
 private void SendResult(IAsyncResult ar)
 {
     socket = (System.Net.Sockets.UdpClient)ar.AsyncState;
     socket.EndSend(ar);
 }