TCP Support Library Error Codes
- Updated2023-02-21
- 2 minute(s) read
TCP Support Library Error Codes
The TCP Support Library functions return negative values when they detect errors. TCP uses a common set of error codes and provides end-to-end error detection and correction and reliable data delivery. Specifically, TCP notifies the sender of packet delivery, guarantees that packets are delivered in the same order in which they were sent, retransmits lost packets, and ensures that data packets are not duplicated. TCP uses a checksum on both the headers and data of each segment to help detect network corruption. The following table lists the error codeserror codes, defined constants, and error messages associated with functions in the the LabWindows/CVI TCP Support Library.
Use the GetTCPErrorString function to convert the error code, returned in the status parameter of TCP Support Library functions, into meaningful error messages.
![]() |
Note Because errors can occur in the underlying Winsock or other operating system components, call GetTCPSystemErrorString to obtain a system message that describes the error. The system messages can be more descriptive than the TCP Support Library error codes. To obtain the correct system error message, you must call GetTCPSystemErrorString immediately after calling the TCP Support Library function that failed. |
Error codes are defined in the cvi\include\tcpsupp.h file.
Value | Code | Error Message |
0 | -kTCP_NoError | No Error |
-1 | -kTCP_UnableToRegisterService | Unable to register service |
-2 | -kTCP_UnableToEstablishConnection | Unable to establish connection |
-3 | -kTCP_ExistingServer | Existing server |
-4 | -kTCP_FailedToConnect | Failed to connect |
-5 | -kTCP_ServerNotRegistered | Server not registered |
-6 | -kTCP_TooManyConnections | Too many connections |
-7 | -kTCP_ReadFailed | Read failed |
-8 | -kTCP_WriteFailed | Write failed |
-9 | -kTCP_InvalidParameter | Invalid parameter |
-10 | -kTCP_OutOfMemory | Insufficient memory |
-11 | -kTCP_TimeOutErr | Timeout error |
-12 | -kTCP_NoConnectionEstablished | No connection established |
-13 | -kTCP_GeneralIOErr | General I/O error |
-14 | -kTCP_ConnectionClosed | Connection closed |
-15 | -kTCP_UnableToLoadWinsockDLL | Unable to load Winsock DLL |
-16 | -kTCP_IncorrectWinsockDLLVersion | Incorrect Winsock DLL version |
-17 | -kTCP_NetworkSubsystemNotReady | Network subsystem not ready |
-18 | -kTCP_ConnectionsStillOpen | Connections still open |
-19 | -kTCP_DisconnectPending | Disconnection pending |
-20 | -kTCP_InfoNotAvailable | Information not available |
-21 | -kTCP_HostAddressNotFound | Host address was not found |
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.
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.