WiFi TCP/IP Send

Send data over TCP/IP network to remote host over wireless network

  • Library:
  • Simulink Support Package for Arduino Hardware / WiFi

Description

The TCP Send block sends data to a remote host or other hardware board over a wireless network. You can set 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.

For more information about the fixed ports and the allocated pins for the block, see Pin Mapping on Arduino Blocks.

Note

If you are having trouble using TCP to communicate with a computer, antivirus or firewall software might be blocking TCP traffic. If so, configure the software to allow the traffic for a specific IP port number.

Supported Hardware

You can use the WiFi TCP/IP Send block only with the following hardware:

  • ESP8266

  • WiFi Shield

  • MKR1000

  • MKR WIFI 1010

Limitations

  • When using ESP8266 hardware, a model can have only one WiFi TCP Receive, WiFi TCP Send, WiFi UDP Receive, or WiFi UDP Send block.

  • When using WiFi Shield, the Connection mode set for all the WiFi TCP Send blocks and WiFi TCP Receive blocks in a model must be same. The WiFi TCP blocks cannot act as servers and clients in a model simultaneously.

  • The maximum number of connections allowed for different ports on WiFi TCP Receive blocks and WiFi TCP Send blocks in a model is two for WiFi shield, seven for MKR1000, and one for ESP8266. If the model uses External mode over Wi-Fi® or includes a WiFi ThingSpeak Read block or WiFi ThingSpeak Write block, one TCP port is reserved for each from the maximum allowed connections.

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. The data is sent in little-endian format. To convert it to a big-endian format, do any of the following:

The maximum number of bytes that can be sent by this block at each time step is shown in the table.

Target Hardware

ESP8266

WiFi Shield

MKR1000

Maximum Number of Sent Bytes

2048641400

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 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 a 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

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

Specify the remote IP address of the 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.

Introduced in R2014a