コード例 #1
0
ファイル: DataSource.cs プロジェクト: 1am3r/UHC_Tracker
 public static void Disconnect()
 {
     if (client != null ) {
         client.Disconnect();
         client = null;
     }
 }
コード例 #2
0
ファイル: DataSource.cs プロジェクト: 1am3r/UHC_Tracker
 public static void Connect(string host, ushort port, bool isRetry = false)
 {
     if (shuttingDown)
         return;
     if (!isRetry)
         ConnectionStatusChanged(ConnectionStatus.Connecting);
     client = new BytesEventTcpClient();
     client.OnConnect += new EventTcpClient.OnConnectEventHandler(client_OnConnect);
     client.OnDataReceived += new BytesEventTcpClient.BytesReceivedEventHandler(client_OnDataReceived);
     client.OnDisconnect += new EventTcpClient.OnDisconnectEventHandler(client_OnDisconnect);
     client.OnRefused += new EventTcpClient.OnRefusedEventHandler(client_OnRefused);
     lastHost = host;
     lastPort = port;
     client.Connect(host, port);
 }