function SimpleSocket($host, $port, $timeout, $block_size = 255) { $this->SimpleStickyError(); if (!($this->_handle = $this->_openSocket($host, $port, $error_number, $error, $timeout))) { $this->_setError("Cannot open [{$host}:{$port}] with [{$error}] within [{$timeout}] seconds"); return; } $this->_is_open = true; $this->_block_size = $block_size; SimpleTestCompatibility::setTimeout($this->_handle, $timeout); }
/** * Opens a socket for reading and writing. * @param string $host Hostname to send request to. * @param integer $port Port on remote machine to open. * @param integer $timeout Connection timeout in seconds. * @access public */ function SimpleSocket($host, $port, $timeout) { $this->StickyError(); $this->_is_open = false; if (!($this->_handle = $this->_openSocket($host, $port, $error_number, $error, $timeout))) { $this->_setError("Cannot open [{$host}:{$port}] with [{$error}] within [{$timeout}] seconds"); } else { $this->_is_open = true; SimpleTestCompatibility::setTimeout($this->_handle, $timeout); } }
/** * Opens a socket for reading and writing. * @param string $host Hostname to send request to. * @param integer $port Port on remote machine to open. * @param integer $timeout Connection timeout in seconds. * @param integer $block_size Size of chunk to read. * @access public */ function __construct($host, $port, $timeout, $block_size = 255) { parent::__construct(); if (!($this->handle = $this->openSocket($host, $port, $error_number, $error, $timeout))) { $this->setError("Cannot open [{$host}:{$port}] with [{$error}] within [{$timeout}] seconds"); return; } $this->is_open = true; $this->block_size = $block_size; SimpleTestCompatibility::setTimeout($this->handle, $timeout); }