Documentation

TCP Troubleshooting

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.

Duplicate Subnet Calculated in Block

You can use a dedicated Ethernet card for TCP communication while using another card for communicating between the development and target computers. 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, the following 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.

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 22222 and 22223. Simulink Real-Time reserves 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 Status output of a TCP configure block to the Enable input of the associated TCP Send and TCP Receive blocks.

Related Topics

Was this topic helpful?