TCP Send

Send data over TCP/IP network to remote host

  • Library:
  • Simulink Coder Support Package for STMicroelectronics Nucleo Boards

Description

The TCP Send block sends data to a remote host or another hardware board over a TCP/IP network. You can set the Connection mode of the block to Server or Client. When you set Connection mode to Client, you must provide the Server IP Address and the Server IP Port on the server to which you want to send data. When you set Connection mode to Server, you must provide the Local IP Port. This Local IP Port acts as a listening port on the TCP/IP server. The server must be up and running before deploying the model that contains the TCP Send block to the target.

The block sends data either in blocking mode or in non-blocking mode. In blocking mode, the model blocks the execution while it waits for the data to be sent completely. In non-blocking mode, the model runs continuously. To set the block in blocking mode, select the Wait until data received option.

Ports

Input

expand all

The block accepts data specified as an N-by-1 array. The block sends this data over a TCP/IP network to the receiving host.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

Parameters

expand all

Set the block as a TCP/IP server or client.

When you set this parameter to Server, you must provide a Local IP Port. The local port acts as the listening port on the TCP/IP server.

When you set this parameter to Client, you must provide the Server IP Address and the Server IP Port on the TCP/IP server to which you want to send the data.

Specify the remote IP address of the receiving server to which the data is sent.

Dependencies

This parameter appears only when you set the Connection mode parameter to Client.

Specify the port number on the receiving server to which data is sent.

Dependencies

This parameter appears only when you set the Connection mode parameter to Client.

Specify the port number of the application from which to send the data. This local port acts as the listening port of the TCP/IP server.

  • When you select this parameter, the send operation runs in blocking mode. If the send operation of the data received in the previous time step is complete, the block accepts data from the input port. If the send operation is in progress, the block waits for the data to be sent and then it accepts data from the input port.

    A task overrun occurs if the target hardware is still waiting for the requested data to be sent when the next send operation is scheduled to begin. To fix overruns:

    • Increase the sample time of input data.

    • Reduce the length of data at the input port.

  • When you clear this parameter, the send operation runs in the non-blocking mode. If the send operation of the data received in the previous time step is still in progress, the data at the input port at the given time step is discarded.

Specify the amount of time (seconds) that the block waits for the data to be available during each time step. If timeout occurs, the read operation is aborted.

Dependencies

This output is available only if the Wait until data received option is checked.

Select this option to display the error status during data transmission.

When you select the Output error status parameter, the block configures an output port. The port on the block is labeled as Status, indicating that the block outputs the status of the read operation at the output port.

Model Examples

See Also

Introduced in R2017a