TCP (FB)

User interface

Input variables

Name

Type

Description

boEnable

BOOL

Enable signal: With a positive edge, the initialisation of the block starts.

As long as 'boEnable' = TRUE, the block remains enabled and is processed by the PLC.

In the state 'boEnable' = FALSE the block is no longer enabled and is thus no longer processed.

enMode

ENUM

EN_WORK_MODE

Selection mode for establishing communication

Default

AUTO_

AUTO_

Automatic mode selection, where the node with the higher IP address becomes ACTIVE and the node with the lower IP address becomes PASSIVE. Suitable for a connection between two controllers

ACTIVE_

In this mode, the function block attempts to establish a connection with the specified node. In the context of client/server connections, this mode is suitable for the client

PASSIVE_

In this mode, the function block waits for a connection request from another node. In the context of client/server connections, this mode is suitable for the server. In this mode, the IP address can be "empty"

strIP

STRING(15)

String containing the IP address (dotted decimal notation) of the node with which a connection is to be established. If this input is not assigned, the controller can connect to a communication partner with any IP address

Default

‘192.168.0.1’

wPort

WORD

Port of the node with which the connection is being established

Default

1500

uiRecvSize

UINT

Size of the receive buffer

pbyRecvBuff

POINTER

POINTER TO BYTE

Pointer variable referencing the receive buffer in which the data received is written

uiSendSize

UINT

Size of the send buffer

pbySendBuff

POINTER

POINTER TO BYTE

Pointer variable referencing the send buffer which contains the data to be sent

Output variables

Name

Type

Description

boEnabAck

BOOL

Acknowledgement: Function block is initialised and enabled

boErr

BOOL

The function block is in an error state

FALSE

No error (permitted commanding or warning)

TRUE

Error

iErrID

INT

Error identity number: Diagnostic number is output

iErrID = 0

No error

iErrID ≠ 0

boErr = TRUE

Error

iErrID ≠ 0

boErr = FALSE

Warning

Error

Range

Meaning

0

No error

1 - 999

Error numbers are described in the library documentation for AmkSockets.lib

For AmkTCP.lib up to Version 02.04 2008/25, the following also applies:

Range

Meaning

101 -

Illegal pointer to the receive buffer

102 -

Illegal pointer to the send buffer

103 -

Incorrect communication mode

For AmkTCP.lib as of Version > 02.04 2008/25, the following also applies:

Range

Meaning

1001 -

Illegal pointer to the receive buffer

1002 -

Illegal pointer to the send buffer

1003 -

Incorrect communication mode

1004

Incorrect instance 'uiChannel' or invalid IP address

1005

Read/write operation interrupted, connection closed

1006

Internal error

boConn

BOOL

Signal for the communication status. TRUE means that a connection to the specified communication partner exists.

boRecvAck

BOOL

Signal indicating that data has been received successfully. The signal is set if the data has been received in full in the buffer and is reset, if the 'uiRecvSize' input is set to “0”.

boSendAck

BOOL

Signal indicating that data has been sent successfully. The signal is set if all of the data has been sent from the buffer and is reset, if the 'uiSendSize' input is set to “0”.

uiActRecv

UINT

Length of data currently received