# Database Datagram Class

Topics

:

Overview
Functions

Overview

The gxDatagram class is derived from the gxSocket class and is used to send and receive database blocks over a UDP connection.

Detailed Description

Functions

gxDatagram::gxDatagram()
gxDatagram::AddBlock()
gxDatagram::ChangeBlock()
gxDatagram::CloseConnection()
gxDatagram::DatagramClient()
gxDatagram::DatagramServer()
gxDatagram::DeleteBlock()
gxDatagram::HostName()
gxDatagram::PortNumber()
gxDatagram::ReadAckBlock()
gxDatagram::ReadClientHeader()
gxDatagram::ReadRemoteAckBlock()
gxDatagram::ReadRemoteBlock()
gxDatagram::RemoteHostName()
gxDatagram::RemotePortNumber()
gxDatagram::RequestBlock()
gxDatagram::SetBlockStatus()
gxDatagram::TerminateConnection()
gxDatagram::WriteAckBlock()
gxDatagram::WriteBlock()
gxDatagram::WriteRemoteAckBlock()
gxDatagram::WriteRemoteBlock()

gxDatagram::gxDatagram()

- Default class constructor.

int gxDatagram::AddBlock(const void *block, gxBlockHeader &block_header)

- Public member function used to request that the block pointed to by the "block" variable be added by a local or remote device. The block header must account for the total length of the data pointed to by the "block" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::ChangeBlock(const void *request, const void *block, gxBlockHeader &request_header, gxBlockHeader &block_header)

- Public member function used to request that the block pointed to by the "block" variable be changed by a local or remote device. The "request" variable points to the new information that will be inserted in place of the block pointed to by the "block" variable. The block header must account for the total length of the data pointed to by the "block" variable and the "request_header" must account for the total length of the data pointed to by the "request" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::CloseConnection()

- Public member function that sends a block command used to close a persistent client or server connection. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::DatagramClient(int port, char *host)

- Public member function used to connect a datagram client to the specified host. Returns zero if no errors occur during initialization or a non-zero value to indicate a failure.

int gxDatagram::DatagramServer(int port)

- Public member function used to initialize a datagram server. Returns zero if no errors occur during initialization or a non-zero value to indicate a failure.

int gxDatagram::DeleteBlock(const void *request, gxBlockHeader &request_header)

- Public member function used to request that the a block pointed to by the "request" variable be deleted. The "request_header" must account for the total length of the data pointed to by the "request" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::HostName(char *hs)

- Public member function that passes back the host name of this machine in the "hs" variable. NOTE: A memory buffer for the "hs" variable equal to gxsMAX_NAME_LEN must be pre-allocated prior to using this function. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::PortNumber(int &port)

- Public member function that passes back the port number actually set by the system in the "port" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::ReadAckBlock()

- Public member function used to read an acknowledgment block. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::ReadClientHeader(gxBlockHeader &gxs)

- Public member function used to read a client header. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::ReadRemoteAckBlock()

- Public member function used to read a client acknowledgment block. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::ReadRemoteBlock(void *buf, gxBlockHeader &gx)

- Public member function used to read a remote block. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::RemoteHostName(char *hs)

- Public member function that passes back the host name of the client in the "hs" variable. NOTE: A memory buffer for the "hs" variable equal to gxsMAX_NAME_LEN must be pre-allocated prior to using this function. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::RemotePortNumber(int &port)

- Public member function that passes back the client's port number in the "port" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

void *gxDatagram::RequestBlock(const void *request, gxBlockHeader &request_header, gxBlockHeader &requested_block_header)

- Public member function used to request a block from the remote end. The "request" variable points to the request information. The "request_header" must account for the total length of the data pointed to by the "request" variable. Returns the requested block or a null value if an error occurs. The block returned by this function must be typecast to the correct type by the calling function.

void gxDatagram::SetBlockStatus(gxBlockHeader &gx, __SBYTE__ net_status,__SBYTE__ file_status = gxRemoteDeviceBlock)

- Public member function used to set the variable block header status member control byte. NOTE: The block's next deleted variable must be set, if needed, after a call to this function. The block length will not be set here.

int gxDatagram::TerminateConnection()

- Public member function used to send a block command that will shutdown a server or client. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::WriteAckBlock()

- Public member function used to write an acknowledgment block. Returns zero if no errors occur or a non-zero value to indicate a failure.

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

- Public member function used to write a block of raw data. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::WriteRemoteAckBlock()

- Public member function used to write an acknowledgment block to the remote end. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxDatagram::WriteRemoteBlock(void *buf, int bytes)

- Public member function used to write a block of raw data to the remote end. Returns zero if no errors occur or a non-zero value to indicate a failure.

End Of Document