National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 7 TCP Library
© National Instruments Corporation 7-3 LabWindows/CVI Standard Libraries
program is invoked to process the request. The parameter prototypes for the TCP callback
functions in LabWindows/CVI are defined below:
int CallbackFunction (int handle, int xType, int errCode,
void *callbackData);
where
handle represents the conversation handle
xType represents the transaction type (see table below)
errCode for
TCP_DISCONNECT
, is negative if the connection is being terminated due to an
error
callbackData is a user-defined data value.
All of the TCP transaction types (xType) that can trigger a callback function are listed in
Table 7-2.
Table 7-2. TCP Transaction Types (xType)
xType Server Client When ?
TCP_CONNECT
Y N When a new client requests for
connection.
TCP_DISCONNECT
Y Y When conversation partner quits.
TCP_DATAREADY
Y Y When conversation partner sends
data.
Refer to the descriptions for
RegisterTCPServer
and
ConnectToTCPServer
for more
information about the TCP callback function.
TCP Library Function Reference
ClientTCPRead
int
status = ClientTCPRead (
unsigned int
conversationHandle,
void
*dataBuffer,
unsigned int
dataSize,
unsigned int
timeout);
Purpose
Reads data from a TCP server application when it contains data that is ready for TCP network
transmission.