メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

TCP Send

Send data over TCP/IP network to remote host

Add-On Required: This feature requires the Simulink Coder Support Package for STMicroelectronics Nucleo Boards add-on.

  • TCP Send block

ライブラリ:
Simulink Coder Support Package for STMicroelectronics Nucleo Boards / STM32F7
Simulink Coder Support Package for STMicroelectronics Nucleo Boards / STM32H7

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.

端子

Input

すべて展開する

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.

データ型: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

Output

すべて展開する

At each time step, when the length of data transmitted is greater than or equal to the length specified in the Data size (N) parameter, the port outputs 0. A value of 0 indicates that the transmitted data is received at the given time step. Otherwise, it outputs a nonzero value, indicating that no new data is transmitted.

データ型: uint16

Parameters

すべて展開する

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.

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.

拡張機能

すべて展開する

C/C++ コード生成
Simulink® Coder™ を使用して C および C++ コードを生成します。

バージョン履歴

R2017a で導入