UDP Receive
Receive UDP data
Add-On Required: This feature requires the Embedded Coder Support Package for AMD SoC Devices add-on.
Libraries:
Embedded Coder Support Package for AMD SoC Devices
Description
The UDP Receive block receives user datagram protocol (UDP) packets from an IP network port and saves them to its buffer. With each sample, the block output the contents of a single UDP packet as a data vector.
Examples
Get Started with Embedded Coder Support Package for AMD SoC Devices
Generate code from a Simulink® model and run the executable on an AMD Zynq® board.
Ports
Outputs
The UDP Receive block outputs the received UDP packets as an N-by-1 data vector. The Data type for Message and Maximum length for Message parameters set the vector data type and length, N, respectively.
This port is unnamed while Output variable-size signal is enabled.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
This port outputs the length of the message vector signal on port
Message
.
This port is hidden while Output variable-size signal is enabled.
Data Types: single
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.
Enter the IP port number on your hardware board that receives UDP data packets.
Note
On Linux®, to set the IP port number below 1024, run MATLAB® with root privileges. For example, at the Linux command line, enter:
sudo matlab
Programmatic Use
Block Parameter:
localURL
|
Enter the IP address from which to accept packets. Entering a specific IP address
blocks UDP packets from other addresses. To accept packets from any IP address, enter
'0.0.0.0'
.
Programmatic Use
Block Parameter:
remoteURL
|
Make the receive buffer large enough to avoid data loss caused by buffer overflows.
Programmatic Use
Block Parameter:
recvBufferSize
|
Enter the maximum length, in vector elements, of the data output vector. Set this parameter to a value greater than or equal to the data size of a UDP packet. The system truncates data that exceeds this length.
If you disable Output variable-size signal, the block outputs a fixed-length output the same length as the Maximum length for Message.
Programmatic Use
Block Parameter:
dims
|
Set the data type of the vector elements in the Message output. Match the data type with the data input used to create the UDP packets.
Programmatic Use
Block Parameter:
signalDatatype
|
To support signals of varying length in your model, select this parameter. To support fixed-length signals, clear this parameter. When you clear this parameter, the block:
Emits a data vector of fixed-length, set by the Maximum length for Message, from the Message output.
Emits the length of the valid data from the Length output.
If the UDP packet contains less data than the fixed-length output, the difference contains invalid data.
In both cases, the block truncates data that exceeds Maximum length for Message.
Programmatic Use
Block Parameter:
isVarSize
|
For each sample, wait this length of time for a UDP packet before returning control
to the scheduler. This value defaults to inf
, which indicates to wait
indefinitely.
Programmatic Use
Block Parameter:
blockingTime
|
Specify how often the scheduler runs this block. Enter a value greater than zero. In real-time operation, setting this option 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 R2016b
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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)