PortWatcher(Session session, 
	      String address, int lport, 
	      String host, int rport,
              ServerSocketFactory factory) throws JSchException{
    this.session=session;
    this.lport=lport;
    this.host=host;
    this.rport=rport;
    try{
      boundaddress=InetAddress.getByName(address);
      ss=(factory==null) ? 
        new ServerSocket(lport, 0, boundaddress) :
        factory.createServerSocket(lport, 0, boundaddress);
    }
    catch(Exception e){ 
      //System.err.println(e);
      String message="PortForwardingL: local port "+address+":"+lport+" cannot be bound.";
      if(e instanceof Throwable)
        throw new JSchException(message, (Throwable)e);
      throw new JSchException(message);
    }
    if(lport==0){
      int assigned=ss.getLocalPort();
      if(assigned!=-1)
        this.lport=assigned;
    }
  }