NBS.TCP_Client (FB)

( CAA_NetBaseServices.library)

A TCP client can handle only one connection. To establish a connection xEnable must be set to TRUE. The return values of these function block are xActive and hConnection. As long as xActive is TRUE the handle of the connection is valid. Is xActive FALSE the handle is invalid. The handle of the connection can be used as input hConnection in the function blocks NBS.TCP_Write, NBS.TCP_WriteBuffer, NBS.TCP_Read and NBS.TCP_ReadBuffer. ipAddr and uiPort indicate the ip and port to establish the connection.

Input:

xEnable

BOOL

see: “CAA 指南”

udiTimeOut

UDINT

Defines the time after which the connection setup aborts with an error message.

ipAddr

NBS.IP_ADDR

Ip address to establish connection

uiPort

UINT

Port to establish connection

Output:

xDone

BOOL

see: “CAA 指南”

xBusy

BOOL

see: “CAA 指南”

xError

BOOL

see: “CAA 指南”

eError

NBS.ERROR

Error id

xActive

BOOL

TRUE: Handle valid

FALSE: Handle invalid

hConnection

CAA.HANDLE

Handle of the connection