コード例 #1
0
 public void Close()
 {
     if (!portIsTcp)
     {
         this.udpClient.Close();
         this.udpClient = null;
     }
     else
     {
         this.tcpServer.Close();
         this.tcpServer = null;
     }
 }
コード例 #2
0
        public void Connect(bool tcp)
        {
            portIsTcp = tcp;
            if (!tcp)
            {
                if (this.udpClient != null) Close();
                this.udpClient = new UdpClient(this.remoteHost, this.remotePort);
            }
            else
            {
                this.tcpServer = new TcpServer(this.remotePort);
                tcpServer.TCPClientConnected+=new ClientConnectedEventHandler(tcpServer_TCPClientConnected);

            }
        }