public function connect()
    {
        if (!is_resource($this->handle)) {
            throw new SocketException("Socket is not available");
        }
        if (! @socket_connect($this->handle, $this->endpoint->getAddress(), $this->endpoint->getPort())) {
            $code = socket_last_error($this->handle);
            throw new SocketException(socket_strerror($code), array(), $code);
        }
        $this->conntected = true;
    }