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.
xEnable |
BOOL |
see: CAA Guidelines |
udiTimeOut |
UDINT |
Defines the time (µs) after which the connection setup aborts with an error message. After the timer has expired xError is set. With udiTimeOut=0 the timeout is deactivated-. |
ipAddr |
NBS.IP_ADDR |
Ip address to establish connection |
uiPort |
UINT |
Port to establish connection |
xDone |
BOOL |
see: CAA Guidelines |
xBusy |
BOOL |
see: CAA Guidelines |
xError |
BOOL |
see: CAA Guidelines |
eError |
NBS.ERROR |
Error id |
xActive |
BOOL |
TRUE: Handle valid FALSE: Handle invalid |
hConnection |
CAA.HANDLE |
Handle of the connection |