TCP Client

Configure TCP client

  • Library:
  • Simulink Real-Time / TCP

Description

Configure a TCP client application. You must have already configured a network interface for IP by the IP Config block.

Ports

Input

expand all

If Enable is greater than zero, the block connects to the Ethernet device. Otherwise, the block does not connect.

Output

expand all

The status value is one of:

  • 0 — Not connected

  • 1 — Connected

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.

Parameters

expand all

If you are using the Ethernet connection between the development and target computers, this value must match the value of the TcpIpTargetAddress target setting. If you are using a dedicated Ethernet card, this value must match the Local IP Address parameter in the IP Config block for the network interface.

The addresses 0.0.0.0 and 255.255.255.255 are invalid IP addresses.

Programmatic Use

Block Parameter: clientAdd

The combination of Client IP address and Client local port must be unique.

When you select the Use host-target connection parameter in the TCP configure blocks, you cannot use ports 22222 and 22223. Simulink® Simulink Real-Time™ reserves these ports for its own use.

Programmatic Use

Block Parameter: clientPort

Enter the IP address of the server to which you want to connect the client.

The addresses 0.0.0.0 and 255.255.255.255 are invalid IP addresses.

Programmatic Use

Block Parameter: remoteAdd

Enter the port number of the server to which you want to connect the client.

When you select the Use host-target connection parameter in the TCP configure blocks, you cannot use ports 22222 and 22223. Simulink Simulink Real-Time reserves these ports for its own use.

Programmatic Use

Block Parameter: remotePort

Introduced in R2017a