Nserialreceive – Measurement Computing Net232 User Manual
Page 13

Net232 User’s Guide,
1037-0901, rev 2.0
13
nSerialReceive
Function: int nSERIALReceive (long session, short port, unsigned short flush, long timeout,
short terminator, short length, char FAR *data, short FAR *xlength, unsigned short
FAR *status);
Parameters:
Long
session
The session handle of the Net232
Short
port
The port being read from.
Unsigned short
flush
Flag to indicate if the receive buffer should be
cleared.
long
timeout
The time, in milliseconds, to wait for received data.
Short
terminator
The terminator to be used for serial input.
Short
length
The maximum number of characters to be
Read into the data buffer.
Char FAR *
data
A buffer where the received characters will be
placed.
Short FAR *
xlength
The number of characters that were read.
Parameter Values:
Port
Net232 = 1
Aux = 0
Flush
retain = 0
Empty = 1
Terminator
none = -1
CRLF = -3
User defined = 0 to 255
Returns: 0 if successful, error code or warning if command not completed.
Description: This function’s primary use is to read data from the Net232’s ethernet interface. The secondary use is
to flush all characters from the Net232’s ethernet interface transmit buffer. Because this function may
take some time to complete, the return value must be tested to see if the command has completed.
The return value for command pending is –801.
Example:
Do {
ErrVal = nSERIALReceive(session, 1, 0, 1000, 13, 100, &dataBuffer,
&xlength);
} while (errVal == -801);