TCP_SEND DFB
(Original Document)
Overview
The TCP_SEND DFB allows a data message to be sent to a remote client application via a TCP/IP connection. The maximum size of the message is 8 kb.
Input Parameters
Parameter
Type
Description
RST
bit
Setting this bit to 1:
  • interrupts the exchange in progress (if the ACTIVITY bit is set to 1)
  • closes the connection
  • sets the ACTIVITY information bit to 0 and the ERROR output bit to 1
The error code is found in the STATUS word.
BUF
word table
This variable defines the address of the first %MWi word of the buffer in order to send the message.
Input/Output Parameters
Parameter
Type
Description
MANAGNT
word table
Management table common to all DFBs
Output Parameters
Parameter
Type
Description
ERROR
bit
This output bit is set to 1 if the exchange is not carried out correctly.
The STATUS word indicates the type of error that has occurred.
Internal Public Data
Parameter
Type
Write/Read Variables
Description
DEST
double word
W
This variable defines the IP address of the remote machine on which the client is connected to the local port.
By default, DEST = 0. The message is sent to the only remote client station connected to the local service port of the PLC.
PORT
word
W
This variable defines the local port number to which the remote client is connected.
SIZE
word
W
This variable defines the size of the message to be sent, from 0 to 8192 bytes.
ACTIVITY
bit
R
This bit is set to 1 when an exchange is in progress. It is set to 0 when the exchange is finished.
INHIB
bit
R
This bit enables the error warning to be inhibited. The ERROR output bit and the STATUS word remain at 0 (execution of the block is not interrupted).
STATUS
word
R
This word is only meaningful if the ERROR output bit is set to 1. It indicates the error code that occurred during the exchange (each word bit set to 1 indicates an error).
Operation
Data transfer is triggered when the TCP_SEND DFB is called, if the RST and ACTIVITY bits are set to 0. During the exchange, the ACTIVITY bit is set to 1. At the end of transmission, the ACTIVITY bit is set to 0. In addition, if the exchange is not correct, the ERROR output bit is set to 1.
At any time, setting the RST bit (priority input) to 1 allows the exchange in progress to be interrupted. The ACTIVITY bit (exchange finished) is set to 0, and the ERROR bit is set to 1. The status word <TCP_SEND instance name>.STATUS indicates the type of error. If the connection is open, it closes, and the module waits for the incoming connection. The TCP_CNX DFB reestablishes the connection to the TCP service port to start sending messages again.
When a message is sent, the following process occurs: