UDP Receive
Receive UDP data
Add-On Required: This feature requires the Embedded Coder Support Package for ARM Cortex-A Processors add-on.
Libraries:
Embedded Coder Support Package for ARM Cortex-A Processors
Description
The UDP Receive block receives user datagram protocol (UDP) data from a remote host. The block reads available UDP data from the socket buffer and outputs the data as a vector.
Examples
Get Started with Embedded Coder Support Package for ARM Cortex-A Processors
Use Embedded Coder® Support Package for ARM® Cortex-A® Processors to run a Simulink® model on an ARM Cortex-A9 (QEMU) emulator.
Ports
Output
UDP data received from remote host, returned as a numeric vector. Set the data type of this output by using the Data type for Message parameter.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
To set the block parameter value programmatically, use
the set_param function.
To get the block parameter value
programmatically, use the get_param function.
Specify the local IP port number of the application on the hardware board on which you want to receive UDP packets. The port number must be an integer from 1 to 65,535.
Note
On Linux®, to set the local IP port number below 1024, run MATLAB® with root privileges. For example, at the Linux command line, enter:
sudo matlab
Programmatic Use
Block Parameter:
localPort
|
Specify the IP address from which the block accepts UDP packets. Entering a specific
IP address blocks, UDP packets from other addresses. To accept packets from all IP
addresses,use default value '0.0.0.0'.
Programmatic Use
Block Parameter:
remoteURL
|
Specify the size of the buffer size in which you want to store the received UDP packets. Specify the receive buffer size to be large enough to avoid data loss caused by buffer overflows.
Programmatic Use
Block Parameter:
recvBufferSize
|
Specify the maximum length of the output UDP data. This value must be greater than or equal to the data size of a UDP packet. The system truncates any data that exceeds this length.
Programmatic Use
Block Parameter:
dims
|
Select the data type of the output UDP data. This data type must be the same as the data type of UDP message sent by the remote host.
Programmatic Use
Block Parameter:
signalDataType
|
Select the Output variable-size signal if your model supports signals for varying length. In this case:
The output vector varies in length, depending on the amount of data in the UDP data received.
The block emits the data vector from a single unlabeled output.
Clear the Output variable-size signal if your model does not support signals of varying length. In this case:
The block emits a fixed-length output of the same length as the Maximum length for Message.
If the UDP packet contains less data than the fixed-length output, the difference contains invalid data.
The Data type for length parameter is enabled.
In both cases, the block truncates data that exceeds Maximum length for Message.
Programmatic Use
Block Parameter:
isVarSize
|
Specify the duration of wait time for a UDP packet at each sample before returning control to the scheduler.
Programmatic Use
Block Parameter:
blockingTime
|
Specify how often the scheduler runs this block. Setting this parameter to a large value reduces the likelihood of dropped UDP messages.
Programmatic Use
Block Parameter:
sampletime
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2014b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
