コード例 #1
0
ファイル: ServerForm.cs プロジェクト: ainochi-kor/HowToCSharp
        public void Disconnect()
        {
            try
            {
                foreach (var pair in ClientList)
                {
                    TcpClient client = pair.Key as TcpClient;
                    client.Close();
                }
                ClientList.Clear();

                if (TcpClient != null)
                {
                    TcpClient.Close();
                }
                if (TcpListner != null)
                {
                    TcpListner.Stop();
                }
            }
            catch (Exception ex)
            {
                ServerEvent.ErrorLog("Disconnect", ex.Message);
            }
        }
コード例 #2
0
ファイル: ServerForm.cs プロジェクト: ainochi-kor/HowToCSharp
        public void Disconnect()
        {
            try
            {
                foreach (var pair in ClientList)
                {
                    TcpClient client = pair.Key as TcpClient;
                    IpPoint  = (IPEndPoint)client.Client.RemoteEndPoint;
                    ClientIP = IpPoint.Address + ":" + IpPoint.Port;
                    DisplayText(ClientIP + " 님의 연결을 해제합니다.");
                    client.Close();
                }
                ClientList.Clear();

                if (TcpClient != null)
                {
                    TcpClient.Close();
                }
                if (TcpListner != null)
                {
                    TcpListner.Stop();
                }
            }
            catch (Exception ex)
            {
                ServerEvent.ErrorLog("Disconnect", ex.Message);
            }
        }
コード例 #3
0
 public void Disconnect()
 {
     if (TcpClient != null)
     {
         TcpClient.Close();
     }
     if (TcpListner != null)
     {
         TcpListner.Stop();
     }
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: ainochi-kor/HowToCSharp
 public void Disconnect()
 {
     try
     {
         if (TcpClient != null)
         {
             TcpClient.Close();
         }
         if (TcpListner != null)
         {
             TcpListner.Stop();
         }
     }
     catch (Exception ex) { }
 }
コード例 #5
0
ファイル: ServerForm.cs プロジェクト: ainochi-kor/HowToCSharp
 public void Disconnect()
 {
     try
     {
         if (TcpClient != null)
         {
             TcpClient.Close();
         }
         if (TcpListner != null)
         {
             TcpListner.Stop();
         }
     }
     catch (Exception ex)
     {
         ServerEvent.ErrorLog("Disconnect", ex.Message);
     }
 }
コード例 #6
0
 public void Disconnect()
 {
     try
     {
         if (TcpClient != null)
         {
             TcpClient.Close();
         }
         if (TcpListner != null)
         {
             TcpListner.Stop();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Disconnect : \r\n" + ex.ToString());
     }
 }