public function write($string, $flags = null) { if ($flags !== null) { return socket_send($this->get_resource(), $string, strlen($string), $flags); } return socket_write($this->get_resource(), $string); }