//--------------------------------------------------------------------- // Ctor //--------------------------------------------------------------------- private SshRelayListener(ISshRelayEndpoint server, int localPort) { this.server = server; this.LocalPort = localPort; this.listener = new TcpListener(new IPEndPoint(IPAddress.Loopback, localPort)); }
/// <summary> /// Create a listener using a defined local port. /// </summary> public static SshRelayListener CreateLocalListener(ISshRelayEndpoint server, int port) { if (port < 0 || port > ushort.MaxValue) { throw new ArgumentException("port"); } return(new SshRelayListener(server, port)); }
//--------------------------------------------------------------------- // Publics //--------------------------------------------------------------------- /// <summary> /// Create a listener using a dynamically selected, unused local port. /// </summary> public static SshRelayListener CreateLocalListener( ISshRelayEndpoint server, ISshRelayPolicy policy) { return(CreateLocalListener(server, policy, PortFinder.FindFreeLocalPort())); }
//--------------------------------------------------------------------- // Ctor //--------------------------------------------------------------------- public SshRelayStream(ISshRelayEndpoint endpoint) { this.endpoint = endpoint; }