What properties, advantages and special features does the TCP protocol offer?
If data is transferred with the TCP protocol, the transfer takes the form of a data stream. There is no information transferred either about the length or about the start and end of a message. The recipient cannot tell where one message ends in the data stream and the next one begins. Therefore, the sender has to specify a message structure which can be interpreted by the recipient. The message structure can, for example, comprise the data followed by a control character, such as "carriage return", signaling the end of a message.
In most cases TCP uses the IP (Internet protocol) which is why people also frequently (and often not altogether correctly) talk about the "TCP/IP protocol". It is in layer 4 of the ISO-OSI reference model.
Fig. 01 - Position in the ISO-OSI reference model
Socket and ports:
Several processes can run simultaneously on multitasking operating systems, whereby each process can provide multiple services. They should be able to be addressed separately.
For this reason, special interfaces, or ports, are defined for data communication both in the TCP/IP and the UDP protocol. This expansion of the host-to-host transfer to a process-to-process transfer is termed application multiplexing and demultiplexing.
Together with the IP address for a station, the port number forms a socket which is defined as the unique address of the user program in the entire network. Therefore, any of a process's services can be addressed to a station within a network using a socket.
In the SIMATIC environment, multiple "simultaneous" processes or user programs cannot be created on one CPU. However, multiple communication jobs may be initiated simultaneously. In order to facilitate unique addressing here as well, assignment must take place via the connection configuration.
The SEND/RECEIVE interface is used for actively transferring data between two client stations. Data is exchanged here between the stations using send and receive blocks
Fetch/Write is a service which is used to read data from a server station or to write data to it. Access takes place via the operating system for the passive server station without any further function calls within the server station. In SIMATIC S7, the fetch/write service is only implemented in server functionality. Therefore, the SIMATIC S7 is unable to actively read or write data. Clients are able to actively read/write data to or from the S7.
|Data area per job||1 - 8192 bytes|
|Interface||Level 4 of the ISO-OSI reference model|
|Number of possible connections||Up to 16 per S7-300 CP|
Up to 64 per S7-400 CP
Advantages of the TCP protocol:
- high-speed communication
- suitable for transferring medium-to-large data volumes (<=8192 bytes)
- routing capability (i.e. can be used in the WAN)
- can be used flexibly in systems of other makes
Disadvantages of the TCP protocol:
- can only transmit static data lengths
- increased programming workload for data management
- Data is transferred as a data stream.
- Entry ID 19033929 contains a complete example of the transmission of data with variable message lengths via the TCP protocol.
- You can find general information about communication via SIMATIC S7 in Entry ID 20982954.