|
QUESTION:
What should you watch out for when using TCP without RFC 1006?
ANSWER:
The CP 343-1 TCP (6GK7 343-1EX00-0XE0 V5.0) and the CP 443-1 (6GK7 443-1EX02-0XE0) in the latest delivery package offer access to TCP connections without RFC 1006.
The behavior of this interface is different to an ISO-on-TCP connection, for example. The difference is in the basic behavior of TCP: TCP works data-flow-oriented and not message-oriented. TCP has no mechanisms that give information about the end of one message and the beginning of a new message. This means that the recipient must know the length of the message and correspondingly parameterize the ANY pointer of the Receive block.
In the case of an ISO-on-TCP connection the information about the message limits is given by the protocol addition RFC 1006 "ISO Transport Service on top of TCP". However, this means that communication is only possible to systems that all support RFC 1006.
Thus in the case of pure TCP there are only two connection options:
- You work with a fixed message length. This means that both the sender and the recipient work with a predefined data length. In this way the message limits are always unambiguously defined.
- You work with variable message lengths. This demands much greater outlay on the recipient side and on the sender side, because the data length must be entered in the first bytes. Upon data reception, the recipient side fetches only the bytes that contain the length of the data. These must be evaluated in the same cycle and then exactly the same number of bytes fetched with another Receive call from the CP. Only then is the message transferred completely into the CPU.
Example:
A PC sends between 50 and 400 bytes to a SIMATIC S7 with CP 443-1. Upon sending the PC program stores the total length of the data in the first 4 bytes. Then the data including this length information is sent to the CP. Via a Receive call only the first 4 bytes of the data received by the CP are fetched in a data block of the CPU. If the length specification is, for example, 212, then a second call with 208 bytes is triggered, which fetches the remaining bytes of the message. Here, you must make sure that the storage location of the data is always large enough and that the data of the first call is not overwritten by that of the second call.
This is just an example. Any amount of data can be fetched with the first call, but not more than the maximum message length may be fetched. Otherwise the Receive waits until the specified data volume is in the receive buffer of the CP. This could then be several messages.
With the S7-300 you should also note that only the blocks FC 50 / FC 60 may be used for a TCP connection, even if the length is less than 240 bytes.
|