beautypg.com

Nserialsend, Nsessionend – Measurement Computing Net232 User Manual

Page 14

background image

14

Net232 User’s Guide,

1037-0901, rev 2.0

nSerialSend

Function: int nSERIALSend (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
Transmitted from the data buffer.

Char FAR *

data

A buffer where the transmitted
Data resides.

Short FAR *

xlength

The number of characters that were sent.

Unsigned short FAR *

status

Not used

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 send data to the Net232’s ethernet interface. The secondary use is to

flush all characters from the Net232’s ethernet interface receive 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 = nSERIALSend(session, 1, 0, 1000, 13, 100, &dataBuffer,
&xlength, &status);

} while (errVal == -801) ;

nSessionEnd

Function: int nSessionEnd (long session);
Parameters:

long

session

The session handle of the Net232

Returns: 0 if successful, error code if not.

Description: This function is used to end an active session. When operations with the Net232 are completed, this

function should be called to end the session.