public function connect($ipAddress, $portNumber, $timeout) {
        $this->ipAddress = $ipAddress;
        $this->portNumber = $portNumber;

        if($this->socketsEnabled) {
            if(!$this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)) {
                throw new SocketException(socket_last_error($this->socket));
            }
            if(!socket_connect($this->socket, $ipAddress, $portNumber)) {
                throw new SocketException(socket_last_error($this->socket));
            }
            socket_set_block($this->socket);
        } else {
            if(!$this->socket = fsockopen("udp://$ipAddress", $portNumber, $socketErrno, $socketErrstr)) {
                throw new SocketException($socketErrstr);
            }
            stream_set_blocking($this->socket, true);
        }
    }