This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

TCP Send

Send data over TCP/IP network to remote host

  • Library:
  • Embedded Coder Support Package for STMicroelectronics Discovery Boards / STM32F746G-Discovery

    Embedded Coder Support Package for STMicroelectronics Discovery Boards / STM32F769I-Discovery

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.

Model Examples

See Also

Introduced in R2017a