DataReelDataReelC++ Toolkit Documentation

Database Block Stream

gxStream sends DataReel database blocks between a client and a server over TLS.

Contents

Overview
Functions

Overview

Each message is a gxBlockHeader followed by block_length bytes; the header's status byte says what the block is (gxSendBlock, gxRequestBlock, gxAddRemoteBlock, gxAcknowledgeBlock, gxCloseConnection and so on). The format is the same as 6.x, but the connection is now a gxsTLSConnection. A client calls Connect(); a server accepts a client with gxsTLSServer::Accept(stream.Connection()). Block lengths read from the network are checked against SetMaxBlockSize() (64 MB by default) before memory is allocated. See examples/tls/stream_server.cpp and stream_client.cpp.

Functions

int gxStream::Connect(const std::string &host, int port = gxsDATA_PORT)

Connects to a server over TLS. Returns 0 (gxSOCKET_NO_ERROR) if successful.

gxsTLSConnection &gxStream::Connection()

The connection, for certificate settings and for servers to accept into.

int gxStream::WriteBlock(const void *buf, int bytes)

Sends a gxSendBlock.

int gxStream::ReadHeader(gxBlockHeader &gx) / ReadBlock(std::vector<unsigned char> &buf, const gxBlockHeader &gx)

Reads the next header and its block.

static __SBYTE__ gxStream::BlockStatus(const gxBlockHeader &gx)

The status byte of a header.

int gxStream::RequestBlock(const void *request, gxBlockHeader &request_header, gxBlockHeader &reply_header, std::vector<unsigned char> &reply)

Sends a request and reads the block sent back.

int gxStream::AddBlock / ChangeBlock / DeleteBlock

Remote database requests.

int gxStream::WriteAckBlock() / ReadAckBlock() / WriteResultBlock(int) / ReadResultBlock(int &)

Acknowledgments and result codes.

int gxStream::CloseConnection() / TerminateConnection() / RestartConnection()

Session control blocks.

void gxStream::SetTimeOut(int seconds) / SetMaxBlockSize(gxUINT32 bytes)

Settings.