internal TcpTransportConnection(ITcpOverUdptSocket socket)
 {
     _socket = socket;
     _transportSocketReader = new Thread(TransportSocketReader)
     {
         IsBackground = true,
         Name         = "_transportSockReaderToUpstreamWriter[" + socket.Connection.ConnectionId + "]"
     };
 }
Example #2
0
 internal TcpTransportConnection(ITcpOverUdptSocket socket)
 {
     _socket = socket;
     _transportSocketReader = new Thread(TransportSocketReader)
         {
             IsBackground = true,
             Name = "_transportSockReaderToUpstreamWriter[" + socket.Connection.ConnectionId + "]"
         };
 }
Example #3
0
 internal ProxyTcpConnection(TcpClient client, ITcpOverUdptSocket socket)
     : base(socket)
 {
     _tcpClient = client;
     _tcpClientProxyReader = new Thread(TcpReaderToTransportSocketWriter) { IsBackground = true };
     _tcpClientProxyReader.Name = "_tcpReaderToTransportSockWriter[" + socket.Connection.ConnectionId + "]";
     _tcpClientProxyReader.Start();
     // start the base class processes
     CompleteInit();
 }
Example #4
0
 internal ProxyTcpConnection(TcpClient client, ITcpOverUdptSocket socket)
     : base(socket)
 {
     _tcpClient            = client;
     _tcpClientProxyReader = new Thread(TcpReaderToTransportSocketWriter)
     {
         IsBackground = true
     };
     _tcpClientProxyReader.Name = "_tcpReaderToTransportSockWriter[" + socket.Connection.ConnectionId + "]";
     _tcpClientProxyReader.Start();
     // start the base class processes
     CompleteInit();
 }
        private bool ProcessConnection(ITcpOverUdptSocket arg)
        {
            var tcpConnection = ProcessConnect(arg);

            if (tcpConnection == null)
            {
                return(false);
            }
            // Fire connection accepted event
            OnConnectionAccepted();
            // Make sure we know when it has closed
            tcpConnection.CloseConnection += TcpConnectionOnCloseConnection;
            _openConnections.Add(tcpConnection);
            return(true);
        }
Example #6
0
 protected override TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket)
 {
     try
     {
         // Attempt to connect end point
         TcpClient client = new TcpClient();
         client.Connect(ProxyEndPoint);
         // Setup the proxying threads
         ProxyTcpConnection proxyTcpConnection = new ProxyTcpConnection(client, socket);
         return(proxyTcpConnection);
     }
     catch (Exception e)
     {
         Logger.Error(
             "Failed to connect to proxy endpoint [" + ProxyEndPoint + "], cannot proxy : " + e.Message, e);
         return(null);
     }
 }
Example #7
0
 protected override TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket)
 {
     try
     {
         // Attempt to connect end point
         TcpClient client = new TcpClient();
         client.Connect(ProxyEndPoint);
         // Setup the proxying threads
         ProxyTcpConnection proxyTcpConnection = new ProxyTcpConnection(client, socket);
         return proxyTcpConnection;
     }
     catch (Exception e)
     {
         Logger.Error(
             "Failed to connect to proxy endpoint [" + ProxyEndPoint + "], cannot proxy : " + e.Message, e);
         return null;
     }
 }
        private void ProcessConnection()
        {
            TcpClient client = this._listener.AcceptTcpClient();

            Logger.Debug("Client connected from  " + client.Client.LocalEndPoint);
            try
            {
                ITcpOverUdptSocket socket             = _transportManager.TCPTransport.OpenConnection(Name);
                ProxyTcpConnection proxyTcpConnection = new ProxyTcpConnection(client, socket);
                proxyTcpConnection.CloseConnection += delegate { ProxyConnectionOnClosed(proxyTcpConnection); };
                _openConnections.Add(proxyTcpConnection);
                OnConnectionAccepted();
            }
            catch (Exception e)
            {
                Logger.Error("Failed to connect to named endpoint " + Name + " : " + e.Message);
                client.Close();
            }
        }
Example #9
0
 protected override TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket)
 {
     var connection = new DefaultTcpTransportConnection(socket, _form.ListeningReader);
     return connection;
 }
Example #10
0
 public DefaultTcpTransportConnection(ITcpOverUdptSocket socket, ProcessTransportRead reader) : base(socket)
 {
     _reader = reader;
     CompleteInit();
 }
Example #11
0
 private bool ProcessOneConnection(ITcpOverUdptSocket socket)
 {
     StopListening();
     return ProcessConnection(socket);
 }
Example #12
0
 private bool ProcessConnection(ITcpOverUdptSocket arg)
 {
     var tcpConnection = ProcessConnect(arg);
     if (tcpConnection == null) return false;
     // Fire connection accepted event
     OnConnectionAccepted();
     // Make sure we know when it has closed
     tcpConnection.CloseConnection += TcpConnectionOnCloseConnection;
     _openConnections.Add(tcpConnection);
     return true;
 }
Example #13
0
 protected abstract TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket);
 private bool ProcessOneConnection(ITcpOverUdptSocket socket)
 {
     StopListening();
     return(ProcessConnection(socket));
 }
 protected abstract TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket);
Example #16
0
        protected override TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket)
        {
            var connection = new DefaultTcpTransportConnection(socket, _form.ListeningReader);

            return(connection);
        }
 public DefaultTcpTransportConnection(ITcpOverUdptSocket socket, ProcessTransportRead reader)
     : base(socket)
 {
     _reader = reader;
     CompleteInit();
 }