WiFi TCP/IP Receive
Receive data over TCP/IP network from remote host on wireless network
Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.
Libraries:
Simulink Support Package for Arduino Hardware /
WiFi
Description
The WiFi TCP/IP Receive block receives data from a remote host or other
hardware over a wireless network. When you set Connection mode to
Server
, you must provide the Local IP port. The
Local IP port acts as a listening port on the TCP/IP server. When you set
Connection mode to Client
, you must provide the
Remote IP address and the Remote IP port of the TCP/IP
server to receive data.
The block accepts data either in Blocking Mode or in Non-Blocking Mode. The block has two output ports, Data and Status. The Data port outputs requested data at each time step. The Status port indicates whether the new data at the specified time step is received.
You can run a Simulink® model containing WiFi TCP/IP Receive block in Connected IO mode on Arduino® boards.
Note
ESP32 and ESP8266 boards are not supported in Connected IO mode.
For more information about the fixed ports and the allocated pins for the block, see Pin Mapping for Arduino Timer Independent 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 Receive block only with the following hardware:
ESP8266
WiFi Shield
MKR1000
MKR WIFI 1010
Nano 33 IoT
Arduino compatible ESP32 – WROOM board
Arduino compatible ESP32 – WROVER board
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
Output
Parameters
More About
Version History
Introduced in R2014a