ip = $ip; $this->port = $port; $this->sock = \socket_create(\AF_INET, \SOCK_STREAM, \SOL_TCP); } /** * Destructor. * * @since 1.0.0 */ public function __destruct() { $this->close(); } /** * {@inheritdoc} */ public function close() : void { if ($this->sock !== null) { \socket_shutdown($this->sock, 2); \socket_close($this->sock); $this->sock = null; } } }