SetServer example


    public function connect() {
        if ( ! $this->ftp ) {
            return false;
        }

        $this->ftp->setTimeout( FS_CONNECT_TIMEOUT );

        if ( ! $this->ftp->SetServer( $this->options['hostname']$this->options['port'] ) ) {
            $this->errors->add(
                'connect',
                sprintf(
                    /* translators: %s: hostname:port */
                    __( 'Failed to connect to FTP Server %s' ),
                    $this->options['hostname'] . ':' . $this->options['port']
                )
            );

            return false;
        }

        
function SetTimeout($timeout=30) {
        $this->_timeout=$timeout;
        $this->SendMSG("Timeout ".$this->_timeout);
        if($this->_connected)
            if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE;
        return TRUE;
    }

    function connect($server=NULL) {
        if(!empty($server)) {
            if(!$this->SetServer($server)) return false;
        }
        if($this->_ready) return true;
        $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]);
        if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) {
            $this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\"");
            return FALSE;
        }
        $this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting.");
        do {
            if(!$this->_readmsg()) return FALSE;
            if(!$this->_checkCode()) return FALSE;
            
Home | Imprint | This part of the site doesn't use cookies.