LabWindows/CVI

Content Type
Programming Language
Current manual

GetTCPPeerName

GetTCPPeerName

int GetTCPPeerName (unsigned int conversationHandle, char buffer[], size_t bufferSize);

Purpose

Obtains the name of the computer on which a remote client or server is currently running.

Parameters

Input
Name Type Description
conversationHandle unsigned int TCP Support Library conversation handle that you obtain from ConnectToTCPServer or ConnectToTCPServerEx or receive in a server callback as the handle parameter of a TCP_CONNECT message.
bufferSize size_t Number of bytes in buffer, including space for the ASCII NUL byte.
Output
Name Type Description
buffer char [] Buffer that GetTCPPeerName fills with the name of the computer on which the remote client or server program is currently running.

Return Value

Name Type Description
status int Return value indicating 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 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.

For RegisterTCPServer and RegisterTCPServerEx, the return value is the port number assigned by the system if you passed zero for the port and the function was successful.

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

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

Additional Information

Library: TCP Support Library

Include file: tcpsupp.h

LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later

Examples

Refer to the following examples that use the GetTCPPeerName function:

  • tcp\client.cws

    Open example
  • tcp\MultiClientServer.cws

    Open example
Was this information helpful?