DTMbeginRead(3DTM)

NAME
DTMbeginRead, DTMbeginWrite - Read/write a header from/to the specified port.

SYNOPSIS
#include <dtm.h>

int DTMbeginRead(int portid, char *header, int size)

int DTMbeginWrite(int portid, char *header, int size)

DESCRIPTION
DTMbeginRead receives a message from the input port specified by portid, and places that message's contents into the buffer header. Size indicates the size of the buffer allocated to hold the incoming header. Though the header may be allocated to any size, DTM_MAX_HEADER, as declared in dtm.h, is defined to be the largest legal header length.

If no message is currently available, DTMbeginRead will block until a message is ready to be received. A non-blocking check for a pending message may be performed with DTMavailRead.

DTMbeginWrite writes the character string header of size size to the output port portid. If the size of the header to be written is unavailable, it may be calculated using DTMheaderLength.

If the message cannot be sent the moment DTMbeginWrite is called, the call will block. A non-blocking check to determine if writing is possible is available with DTMavailWrite.

SEE ALSO
DTM, DTMavailRead, DTMavailWrite

DIAGNOSTICS
Both functions return the status of their operation. If the error DTMERROR is returned, the error flag DTMerrno may be set to any one of the following values:

	DTMPORTINIT	Invalid value for portid.
	DTMSOCK		Problem creating connection.
	DTMREAD		Problem reading from connection.
	DTMHEADER	Incoming header exceeds buffer size.
	DTMWRITE	Error writing header.
	DTMTIMEOUT	Time-out waiting for receiver.