SEND/RECEIVE Interface in the User Program
80
SIMATIC NET NCM S7 for Industrial Ethernet
C79000-G8976-C129–06
3.4
Additional Information
3.4.1
Programming Data Transfer on TCP Connections
Purpose of TCP Connections
TCP connections should be used above all for connections to systems of a
different type if they do not support RFC1006.
For communication between devices of the SIMATIC family, you should use the
more convenient ISO-on-TCP connections! The following sections explain certain
special points to note.
Special Features
S
Block types (FC calls)
Use only the following functions (FCs) for data transmission:
– With the S7-CPs for S7-400, you must use FCs AG_LSEND (FC 50) and
AG_LRECV (FC 60) on TCP connections!
– With the latest S7-CPs for S7-300, you also use FCs AG_SEND (FC 5) and
AG_RECV (FC 6) for TCP connections.
S
Frame length
On the TCP connections, the protocol contains no information about the end of
a message and start of a new message.
The receiving station must therefore know how many bytes belong to a
message and transfer an ANY pointer corresponding exactly to this length when
FC AG_LRECV is called. (Example: if 100 bytes of data are always transferred,
the ANY pointer could appear as: P#DB100.DBX 0.0 Byte 100)
If you want to receive data with a variable length, follow the steps below:
Include information on the length of the user data in the frame before the actual
user data. In the receiving station, you evaluate only the length information and
then fetch the appropriate amount of data in a further receive job. Fetch the
appropriate length of user data in another receive job by specifying an ANY
pointer of the required length on the FC interface for fetching the actual user
data.