TCP Support Library Error Conditions

If an error condition occurs during a call to any of the functions in the LabWindows/CVI TCP Support Library, the status return value contains the error code. This code is a nonzero value that specifies the type of error that occurred. Error codes are negative numbers. The following table lists the currently defined error codes and their associated meanings.

The return value indicates whether the function was successful. Unless otherwise stated, zero represents successful execution and a negative number represents the error code.

You can call the GetTCPSystemErrorString function to obtain a system message that describes the error. The system messages can be more descriptive than the TCP Library error codes. To obtain the correct system error message, you must call GetTCPSystemErrorString immediately after calling the TCP Library function that failed.

For functions that read or write data (ClientTCPRead, ClientTCPWrite, ServerTCPRead, ServerTCPWrite), the return value indicates the number of bytes transferred if the function was successful.

The following enumerated types are declared in tcpsupp.h. They specify the absolute values of the error codes. For instance, if a 'read fail' error occurs, the function returns -kTCP_ReadFailed.

TCP Support Library Error Codes

Value Error Code
0 -kTCP_NoError
-1 -kTCP_UnableToRegisterService
-2 -kTCP_UnableToEstablishConnection
-3 -kTCP_ExistingServer
-4 -kTCP_FailedToConnect
-5 -kTCP_ServerNotRegistered
-6 -kTCP_TooManyConnections
-7 -kTCP_ReadFailed
-8 -kTCP_WriteFailed
-9 -kTCP_InvalidParameter
-10 -kTCP_OutOfMemory
-11 -kTCP_TimeOutErr
-12 -kTCP_NoConnectionEstablished
-13 -kTCP_GeneralIOErr
-14 -kTCP_ConnectionClosed
-15 -kTCP_UnableToLoadWinsockDLL
-16 -kTCP_IncorrectWinsockDLLVersion
-17 -kTCP_NetworkSubsystemNotReady
-18 -kTCP_ConnectionsStillOpen
-19 -kTCP_DisconnectPending
-20 -kTCP_InfoNotAvailable
-21 -kTCP_HostAddressNotFound

Remarks

You can have a maximum of 255 concurrent conversations and 1,024 connections. If you exceed this limit, LabWindows/CVI returns -kTCP_TooManyConnections. You might not be able to open the maximum number of connections allowed by LabWindows/CVI because of limitations imposed by the operating system.