internal TcpTransportConnection(ITcpOverUdptSocket socket) { _socket = socket; _transportSocketReader = new Thread(TransportSocketReader) { IsBackground = true, Name = "_transportSockReaderToUpstreamWriter[" + socket.Connection.ConnectionId + "]" }; }
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); }
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); } }
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(); } }
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(); }
private bool ProcessOneConnection(ITcpOverUdptSocket socket) { StopListening(); return ProcessConnection(socket); }
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; }
protected abstract TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket);
private bool ProcessOneConnection(ITcpOverUdptSocket socket) { StopListening(); return(ProcessConnection(socket)); }
protected override TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket) { var connection = new DefaultTcpTransportConnection(socket, _form.ListeningReader); return(connection); }