示例#1
0
文件: Server.cs 项目: gwupe/Gwupe
 private void ReceiveConnection(ISocket socket)
 {
     Socket = socket;
     Socket.ConnectionOpened += (sender, args) => { Closed = false; };
     Socket.ConnectionClosed += (sender, args) => Close();
     _proxy = new StreamProxy(Socket, new BmTcpSocket(new IPEndPoint(IPAddress.Loopback, VNCPort)));
     _proxy.Start();
 }
示例#2
0
文件: Client.cs 项目: gwupe/Gwupe
 internal int Start(String connectionId)
 {
     // First we need p2p connection
     Socket = GwupeClientAppContext.CurrentAppContext.P2PManager.GetP2PConnection(SecondParty, connectionId);
     // Now we need to create a proxy
     var tcpSocket = new BmTcpSocket(new IPEndPoint(IPAddress.Any,0));
     tcpSocket.BindListen();
     _proxy = new StreamProxy(tcpSocket, Socket);
     Socket.ConnectionOpened += (sender, args) => { Closed = false; };
     Socket.ConnectionClosed += (sender, args) => Close();
     _proxy.Start();
     Thread.Sleep(5000); // sometimes we connect before the listener has started listening, pause here.
     LocalEndPoint = tcpSocket.LocalEndPoint;
     return tcpSocket.LocalEndPoint.Port;
 }
示例#3
0
文件: Client.cs 项目: gwupe/Gwupe
 internal override void Close()
 {
     if (!Closing && !Closed)
     {
         Logger.Debug("Closing RemoteDesktop Proxy to local service");
         Closing = true;
         if (_proxy != null)
         {
             _proxy.Close();
         }
         Closing = false;
         Closed = true;
         _proxy = null;
     }
 }
示例#4
0
文件: Server.cs 项目: gwupe/Gwupe
 // This is called by the RDP Function, so stop listening and terminate connections
 internal override void Close()
 {
     if (!Closing && !Closed)
     {
         Logger.Debug("Closing RemoteDesktop ServerProxy");
         Closing = true;
         if (_proxy != null)
         {
             _proxy.Close();
         }
         _proxy = null;
         Closing = false;
         Closed = true;
     }
 }