WiFi UDP Receive
R2026bReceive data from UDP host on wireless network
Libraries:
Simulink Support Package for Arduino Hardware /
WiFi
Description
Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.
The WiFi UDP Receive block receives data from a UDP host on a wireless network. At each sample time, the block outputs data as a vector of the size specified in the Data size (N) parameter. The block receives data on the port number specified in the Local IP Port parameter. Match the port number specified in the Local IP Port parameter with the remote port number on the sending host.
The block supports reception of both fixed and variable-length UDP packets. The block also supports blocking mode, allowing you to wait for incoming UDP data up to a specified timeout.
Note
If you are having trouble using UDP to communicate with a computer, antivirus or firewall software might be blocking UDP traffic. If so, configure the software to allow the traffic for a specific IP port number.
You can run a model containing WiFi UDP Receive block in connected IO mode on Arduino® boards.
For more information about the fixed ports and the allocated pins for the block, see Pin Mapping for Arduino Timer-Independent Blocks.
Supported Hardware
You can use the WiFi UDP Receive block only with the following hardware:
ESP8266
WiFi Shield
MKR1000
MKR WIFI 1010
Nano 33 IoT
ESP32–S3 series (Arduino compatible)
ESP32–WROOM (Arduino compatible)
ESP32–WROVER (Arduino compatible)
Limitations
When using ESP8266 hardware, a model can have only one of these blocks: WiFi TCP/IP Receive, WiFi TCP/IP Send, WiFi UDP Send, WiFi UDP Receive block.
The maximum number of connections allowed for different ports on WiFi UDP Receive and WiFi TCP/IP Send blocks in a model is two for WiFi shield, four for boards with on-board Wi-Fi®, and one for ESP8266. If the model uses external mode over Wi-Fi or includes a WiFi ThingSpeak Read or WiFi ThingSpeak Write block, one UDP port is reserved for each from the maximum allowed connections.




