예제 #1
0
 // 使用套接字客户端发送消息
 static void SendMessage(SocketClient client, string data)
 {
     try
     {
         client.SendAsync(data);
     }
     catch (Exception ex)
     {
         Console.WriteLine("当发送消息时,发生异常:\n" + ex.Message);
         client.Close();
         Console.WriteLine("客户端断开连接。");
     }
 }
예제 #2
0
파일: Program.cs 프로젝트: thexur/1code
 // User SocketClient to send message
 static void SendMessage(SocketClient client, string data)
 {
     try
     {
         client.SendAsync(data);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Exception occured when sending message:\n" + ex.Message);
         client.Close();
         Console.WriteLine("Client disconnected.");
     }
 }
예제 #3
0
 // 使用套接字客户端发送消息
 static void SendMessage(SocketClient client, string data)
 {
     try
     {
         client.SendAsync(data);
     }
     catch (Exception ex)
     {
         Console.WriteLine("当发送消息时,发生异常:\n" + ex.Message);
         client.Close();
         Console.WriteLine("客户端断开连接。");
     }
 }