TCP Library Chapter 7
LabWindows/CVI Standard Libraries 7-6 © National Instruments Corporation
Return Value
status integer Refer to error codes in
Table 7-3.
Parameter Discussion
clientCallbackFunction is the name of the function called to process messages to your program
as a TCP client.
The callback function must be of the following form:
int (*tcpFuncPtr) (int handle, int xType, int errCode, void *callbackData);
The xType (transaction type) parameter specifies the type of message received from the server.
The client callback function can receive the following transaction types.
TCP_DISCONNECT
TCP_DATAREADY
The errCode parameter is used only when the transaction type is TCP_DISCONNECT.
The following describes each transaction type.
TCP_DISCONNECT—Received when a server 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 server has sent data via TCP to the client. Your
program, acting as the client, should call ClientTCPRead to obtain the data.
The client callback function should return TRUE if the message can be processed successfully.
Otherwise, the function should return FALSE.
Note: The callback function 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 client.
You should define the meaning of the callback data. One way to use the callbackData is as a
pointer to a data object that you need to access in the callback function. In this way, you would
not need to declare the data object as a global variable.
If you do not want to use the callbackData, you can pass zero.