HSOCKET_TO_STRINGEX

HSOCKET_TO_STRINGEX 1:

The function converts the connection handle of type T_HSOCKET to a string (e.g. for debug outputs).

The returned string has the following format: "Handle:0xA[BCD] Local:a[aa].b[bb].c[cc].d[dd]:port Remote:a[aa].b[bb].c[cc].d[dd]:port".

Example: "Handle:0x4001 Local:172.16.6.195:28459 Remote:172.16.6.180:2404"

The parameters bLocal and bRemote determine whether the local and/or remote address information should be included in the returned string.

Syntax

FUNCTION HSOCKET_TO_STRINGEX : STRING
VAR_INPUT
    hSocket : T_HSOCKET;
    bLocal  : BOOL;
    bRemote : BOOL;
END_VAR

HSOCKET_TO_STRINGEX 2: Return value

Name

Type

Description

HSOCKET_TO_STRINGEX

STRING

Contains the hex-based STRING representation of the connection handle.

HSOCKET_TO_STRINGEX 3: Inputs

Name

Type

Description

hSocket

T_HSOCKET

The connection handle to be converted.

bLocal

BOOL

TRUE: Include the local address, FALSE: Exclude the local address.

bRemote

BOOL

TRUE: Include the remote address, FALSE: Exclude the remote address.

Requirements

Development environment

Target system type

PLC libraries to include (category group)

TwinCAT v3.1.0

PC, or CX (x86, X64, Arm®)

Tc2_TcpIp (communication)