TCP Transport Protocol
The Simulink® Real-Time™ software supports communication from the target computer to other systems or devices by using Transmission Control Protocol (TCP). TCP provides ordered and error-checked packet transport.
TCP is a transport protocol layered on top of the Internet Protocol (IP). It is commonly known as TCP/IP.
Stream — TCP is a stream-oriented protocol.
TCP is a stream of data that flows from one end of the network to the other. Another stream of data flows in the other direction. The TCP stack at the transmitting end is responsible for breaking the stream of data into packets and sending those packets. The stack at the receiving end is responsible for reassembling the packets into a data stream by using information in the packet headers.
Connection — TCP is a connection-based protocol.
In TCP, the two ends of the communication link must be connected throughout the communication.
Error Detection — TCP detects errors.
TCP packets contain a unique sequence number. The starting sequence number is communicated from the transmitter to the receiver at the beginning of communication. The receiver acknowledges each packet. That acknowledgment contains the sequence number so that the sender knows which packet was acknowledged. Lost packets can be retransmitted. The sender knows that they did not reach their destination because the sender did not receive an acknowledgment. The receiver can reassemble in order packets that arrive out of sequence. Timeouts can be established because the sender knows from the first few packets how long it takes to transmit a packet and receive its acknowledgment.
TCP communication requires a continuous connection and two-way streaming data is exchanged.
When describing TCP, the words reliable and unreliable have a specific meaning.
Reliable means that if a packet is not acknowledged, it is retransmitted. It does not mean that the protocol always succeeds.
Unreliable means that if too many packets are not acknowledged, the protocol can time out. It does not mean that the protocol packets usually fail to arrive.
You can construct a packet from Simulink data types such as double
, int8
,
int32
, uint8
, or a combination of these data
types. The Simulink
Real-Time block library provides blocks for combining various signals into one
packet (packing), and then transmitting it. It also provides blocks for splitting a
packet (unpacking) into its component signals that you can then use in a Simulink model.
This information applies to both communication with a shared Ethernet board and communication with a dedicated Ethernet board. Consider adding a dedicated Ethernet board for enhanced performance over communication that uses a shared Ethernet board. Shared TCP communication shares bandwidth with the link between the MATLAB® development computer and Speedgoat® target computers.
See Also
TCP Receive | TCP Send | TCP Client | TCP Server