internal PortWatcher(Session session,
                             String address, int lport,
                             String host, int rport,
                             ITcpListenerFactory factory)
        {
            this.session = session;
            this.lport   = lport;
            this.host    = host;
            this.rport   = rport;
            try {
                boundaddress = Dns.GetHostEntry(address).AddressList[0];
#if false
                ss = (factory == null) ?
                     new JTcpListener(lport, 0, boundaddress) :
                     factory.createServerSocket(lport, 0, boundaddress);
#else
                if (factory == null)
                {
                    ss = new TcpListener(boundaddress, lport);
                    ss.Start();
                }
                else
                {
                    ss = factory.createServerSocket(lport, 0, boundaddress);
                }
#endif
            }
            catch (Exception e) {
                Console.WriteLine(e);
                throw new SshClientException("PortForwardingL: local port " + address + ":" + lport + " cannot be bound.");
            }
        }