public function __construct($host = 'localhost', $port = 8000, $ssl = false) { parent::__construct($host, $port, $ssl); $this->log('Server created'); $this->_host = $host; $this->_port = $port; }
/** * ClientSocket constructor */ public function __construct($addr) { parent::__construct(); $this->address = $addr; $proto = strtolower(strtok($addr, ":")); $s = strtok(""); if ($proto === "udp" || $proto === "unix") { $this->real_address = $addr; } else { $this->real_address = "tcp:" . $s; if ($proto != "tcp") { switch ($proto) { case "ssl": $this->crypto_type = STREAM_CRYPTO_METHOD_SSLv23_CLIENT; break; case "tls": $this->crypto_type = STREAM_CRYPTO_METHOD_TLS_CLIENT; break; case "sslv2": $this->crypto_type = STREAM_CRYPTO_METHOD_SSLv2_CLIENT; break; case "sslv3": $this->crypto_type = STREAM_CRYPTO_METHOD_SSLv3_CLIENT; break; default: if (defined($cname = "STREAM_CRYPTO_METHOD_" . strtoupper($proto) . "_CLIENT")) { $this->crypto_type = constant($cname); } } } } }
/** * ServerSocket constructor */ public function __construct($addr) { parent::__construct(); $this->address = $addr; $proto = strtolower(strtok($addr, ":")); if ($proto === "udp" || $proto === "unix") { $this->real_address = $addr; } else { $this->real_address = "tcp:" . strtok(""); if ($proto !== "tcp") { switch ($proto) { case "ssl": $this->crypto_type = STREAM_CRYPTO_METHOD_SSLv23_SERVER; break; case "tls": $this->crypto_type = STREAM_CRYPTO_METHOD_TLS_SERVER; break; case "sslv2": $this->crypto_type = STREAM_CRYPTO_METHOD_SSLv2_SERVER; break; case "sslv3": $this->crypto_type = STREAM_CRYPTO_METHOD_SSLv3_SERVER; break; default: if (defined($cname = "STREAM_CRYPTO_METHOD_" . strtoupper($proto) . "_SERVER")) { $this->crypto_type = constant($cname); } else { throw new ServerException("unknown transport/crypto type '{$proto}'"); } } } } }
/** * IPC Socket constructor * * @param resource $fd * @param int $pid */ public function __construct($fd, $pid = false) { parent::__construct($fd); $this->Set_Write_Buffer(self::IPC_MAX_PACKET_SIZE); $this->pid = $pid; }
/** * The WebSocketConnection constructor. Initializes the connection object and * retrieves host and port information from the remote host. * * @param resource $rSocket The newly accepted socket resource * @param array $aAllowedProtocols Array containing allowed subprotocols for the connection */ public function __construct($rSocket, $aAllowedProtocols) { $this->m_rSocket = $rSocket; /* Get the remote hosts host en port information and split them */ $sRemoteHost = explode(':', stream_socket_get_name($this->m_rSocket, true)); /* Call parent contructor and pass the host info */ parent::__construct($sRemoteHost[0], $sRemoteHost[1]); /* Set the allowed subprotocols */ $this->m_aAllowedProtocols = $aAllowedProtocols; /* Update readystate and TCP status */ $this->m_nReadyState = self::STATE_NEW; $this->m_bConnected = true; }
public function __construct($pHost = 'localhost', $pPort = 4567) { parent::__construct($pHost, $pPort); $this->apps = array(); $this->log("Server created\n"); }
public function __construct($host, $port, $ssl = false) { parent::__construct($host, $port, $ssl); $this->log('Server created'); }
/** * Constructor * * @param string host hostname or IP address * @param int port * @param resource socket default NULL */ public function __construct($host, $port, $socket = null) { parent::__construct($host, $port, $socket); $this->_prefix = 'udp://'; }
public function __construct($host = 'localhost', $port = 8000, $max = 100) { parent::__construct($host, $port, $max); $this->log('Server created'); }
public function __construct($host = 'localhost', $port = 8000, $ssl = false) { parent::__construct($host, $port, $ssl); $this->log('Server started listening to port 8000'); }
/** * @desc 构造函数,初始化Socket父类为SOCK_DGRAM类型 */ public function __construct($iFamily = AF_INET) { parent::__construct(SOCK_DGRAM, $iFamily); }
/** * Constructor for the WebSocketServer class * * @param string $sHost The host or IP on which to listen * @param int $nPort The port number on which to listen * @param boolean $bSecure True if the server is using TLS (is secure) * @param string $sBindIp The IP to whit the server should be bind * @param array $aAllowedProtocols The allowed subprotocols */ public function __construct($sHost, $nPort, $bSecure, $sBindIp = null, $aAllowedProtocols = array()) { parent::__construct($sHost, $nPort, $bSecure, $sBindIp); $this->m_aProtocols = $aAllowedProtocols; }