I want to resolve
TCP block configuration problems.
TCP is a transport protocol layered on top of the Internet Protocol (IP). It is commonly known as TCP/IP. If the block configuration or signal connections for TCP blocks do not follow best practices, the blocks generate errors. Apply these guidelines:
TCP Blocks Run Only on Target Computer
The Simulink® Real-Time™ TCP blocks function only when executed on the target computer. When simulated on the development computer, they do nothing.
Excluded Ports When Using Host-Target Connection
When you select the Use host-target connection parameter
in the TCP configure blocks, you cannot use ports
these ports for its own use.
Order of Operation of TCP Blocks
The real-time application must execute the TCP configure blocks before it executes the TCP Send or TCP Receive blocks.
As a best practice, connect the
of a TCP configure block to the
Enable input of
the associated TCP Send and TCP Receive blocks.
You can use a dedicated Ethernet card for TCP communication while using another card for communicating between the development and target computers. If there is a duplicate subnet calculated in a TCP block, you can get the following error during model initialization:
The subnet in this block is the same as or is a subset of the subnet calculated in ''block''. The block calculates the subnet by ANDing the IP address bitwise with the subnet mask.
Check the IP address and subnet you assigned to the target computer Ethernet card in the configuration block. The TCP implementation requires that the two communication channels use separate subnets.
The block calculates the subnet by ANDing the IP address bitwise with the subnet mask for each card. For example, these specifications result in the same subnet for both cards.
E1 (development-target): IP address: 192.168.0.25 Subnet mask: 255.255.255.0 ------------- Calculated Subnet: 192.168.0.0 E2 (TCP): IP address: 192.168.0.26 Subnet mask: 255.255.255.0 ------------- Calculated Subnet: 192.168.0.0
Try a configuration such as the following:
E1 (development-target): IP address: 192.168.0.25 Subnet mask: 255.255.255.0 ------------- Calculated Subnet: 192.168.0.0 E2 (TCP): IP address: 192.168.0.26 Subnet mask: 255.255.255.2 ------------- Calculated Subnet: 192.168.0.2
In some networks, the development computer must also be in the subnet where the TCP communication occurs. You can either add a second network card to the development computer or provide a gateway device to create a dedicated network for TCP communication.