UDP Receive
Receive UDP packets from another UDP host on an Internet network
Libraries:
Simulink Support Package for LEGO MINDSTORMS EV3 Hardware
Simulink Coder Support Package for BeagleBone Blue Hardware /
Communication
Simulink Support Package for Android Devices /
Communication
Description
Receive UDP packets from the local network. The block output, data, emits UDP packet data as a one-dimensional vector of a specified data type. The block output, size, emits the size the data in the UDP buffer.
The data type of the block output, Data
,
depends on the Data type parameter. The data
type of the block output, Size
, is uint16
.
While UDP Receive waits for new data to arrive, size emits a stream of zeros. When new data arrives, size changes to a non-zero value.
If you simulate a model that contains the UDP Receive block on your host computer (e.g., Simulation > Normal), and send UDP packets to that model from a board, the data output emits a disproportionately large number of zeros. This is because Simulink® software simulates the model as a free-running application with a shorter period than the real-time application running on the board. In other words, the free-running simulation outputs zeros because it is waiting for the “slower” real-time application on the board to send data. If both applications were running on boards, this mismatch would not occur.
Note
If you are having trouble using UDP to communicate with a computer, investigate whether antivirus or firewall software might be blocking UDP traffic. If so, try configuring the software to allow UDP traffic for a specific IP port number.
Examples
Ports
Output
Parameters
Extended Capabilities
Version History
Introduced in R2017a