Main Content

WiFi TCP Send

Send TCP/IP packets to another TCP/IP host on internet network

Since R2021a

Add-On Required: This feature requires the Embedded Coder Support Package for STMicroelectronics STM32 Processors add-on.

  • WiFi TCP Send block

Libraries:
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32L475VG-Discovery (B-L475E-IOT01A)

Description

The WiFi TCP Send block sends data to a remote host or other hardware board over a wireless network.

Note

Your antivirus software or firewall might block TCP traffic. Configure the software to allow traffic from a specific IP port number.

Limitations

  • The sample time of the WiFi TCP Send and WiFi TCP Receive blocks should be more than 0.1 s, as the Wi-Fi® module on the board does not support sending data at a faster rate.

  • The maximum number of times a server can be started or restarted on the board is three. So:

    • The maximum number of blocks supported in the server mode is three.

    • When the model has a block in the server mode, and the client connected to that block/port gets disconnected for some reason, the server is restarted on the board for that block/port.

  • When you configure the block in the client mode, the remote server must be up and running before deploying the model that contains the WiFi TCP Send block to the target. If server is not running, there will be some fixed waiting time (while trying to connect to the server) at every execution. This might lead to overruns until the server is up again.

  • When using the WiFi TCP Send, WiFi TCP Receive, ThingSpeak Read, and ThingSpeak Write blocks in a model, the blocks must have the same sample time as the driver code is nonreentrant.

Ports

Input

expand all

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

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

Parameters

expand all

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

When you set this parameter to Server, you must specify 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 specify Remote IP address and the Remote IP port on the TCP/IP server to which you want to send the data. Before you deploy a model that includes a client WiFi TCP/IP Send block, ensure that the server is up and running.

Specify the port number of the application from which data is sent. This local port acts as the listening port on the TCP/IP server.

Dependencies

To enable this parameter, set Connection mode parameter to Server.

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

Dependencies

To enable this parameter, set Connection mode parameter to Client.

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

Dependencies

To enable this parameter, set Connection mode parameter to Client.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2021a