Chapter 7 TCP Library
© National Instruments Corporation 7-9 LabWindows/CVI Standard Libraries
Return Value
status integer Refer to error codes in
Table 7-3.
Parameter Discussion
serverCallbackFunction is the name of the function to be called to process client requests.
The callback function must be of the following form:
int (*tcpFuncPtr) (int handle, int xType, int errCode,
void *callbackData)
The xType parameter specifies the type of message received from the server. The server
callback function can receive the following transaction types.
TCP_CONNECT
TCP_DISCONNECT
TCP_DATAREADY
The errCode parameter is used only when the transaction type is TCP_DISCONNECT.
The following describes each transaction type.
TCP_CONNECT—The transaction type is received when a client is requesting a connection.
TCP_DISCONNECT—Received when a client is requesting the termination of a connection, or
when a connection is being terminated due to an error. If the connection is terminated due to an
error, the errCode parameter contains a negative error code. Refer to Table 7-3 for the list of
error codes.
TCP_DATATREADY—Received when the client has sent data via TCP to the server. Your
program, acting as the server, should call ServerTCPRead to obtain the data.
The server callback function should return TRUE if the request is successful. Otherwise, the
function should return FALSE.
Note: Server callback should be short and should return as soon as possible.
callbackData is a four-byte value that will be passed to the callback function each time it is
called for this server.