WordPress at Your Fingertips
function is not described

ftp_base::SetServer() public WP 1.0

{} It's a method of the class: ftp_base{}

No Hooks.

Return

null. Nothing.

Usage

$ftp_base = new ftp_base();
$ftp_base->SetServer( $host, $port, $reconnect );
$host (required)
-
$port **
-
Default: 21
$reconnect **
-
Default: true

Code of ftp_base::SetServer() WP 5.8.2

function SetServer($host, $port=21, $reconnect=true) {
	if(!is_long($port)) {
        $this->verbose=true;
    	    $this->SendMSG("Incorrect port syntax");
		return FALSE;
	} else {
		$ip=@gethostbyname($host);
        $dns=@gethostbyaddr($host);
        if(!$ip) $ip=$host;
        if(!$dns) $dns=$host;
        // Validate the IPAddress PHP4 returns -1 for invalid, PHP5 false
        // -1 === "255.255.255.255" which is the broadcast address which is also going to be invalid
        $ipaslong = ip2long($ip);
		if ( ($ipaslong == false) || ($ipaslong === -1) ) {
			$this->SendMSG("Wrong host name/address \"".$host."\"");
			return FALSE;
		}
        $this->_host=$ip;
        $this->_fullhost=$dns;
        $this->_port=$port;
        $this->_dataport=$port-1;
	}
	$this->SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\"");
	if($reconnect){
		if($this->_connected) {
			$this->SendMSG("Reconnecting");
			if(!$this->quit(FTP_FORCE)) return FALSE;
			if(!$this->connect()) return FALSE;
		}
	}
	return TRUE;
}