Main Content

UDP Read (HOST)

Receive UDP packets on local host computer from remote host

  • UDP Read (HOST) block

Libraries:
SoC Blockset / Host I/O

Description

The UDP Read (HOST) block receives UDP (User Datagram Protocol) packets from remote host on the local host. The local host in the host computer on which you want to receive UDP packets. The remote host is the host computer or hardware from which you want to receive UDP packets.

Ports

Output

expand all

UDP packet received on local host computer, returned as a numeric vector. The Data type for Message and Length parameters set this output data type and packet length, respectively.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean

Length of UDP packet returned on the data port.

This port is unnamed until you clear the Output variable-size signal parameter.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean

Parameters

expand all

Specify the IP port number of local host.

Note

On Linux®, to set the local IP port number to a value less than 1024, run MATLAB® with root privileges. For example, at the Linux command line, enter:

sudo matlab

Specify the IP address of the remote host. Set this value to a specific IP address, to block UDP packets from all other IP addresses. To accept UDP packets from all IP addresses, use the default value '0.0.0.0'.

Specify the maximum number of data bytes of UDP packets you want to store in the local buffer. Set this value large enough to avoid data loss caused by buffer overflows.

Specify the maximum length of the output UDP packet. Set this parameter to a value equal to or greater than the data size of the UDP packet. The block truncates any data that exceeds this length.

The maximum payload size of a UDP packet is 65,507 bytes. The Maximum length for Message is equal to the maximum payload size of a UDP packet in bytes divided by the data type size of the UDP packet. For example, if the output data type is double, then set Maximum length for Message value to 65507/8 = 8118.

Select the data type for the vector elements of output UDP packet. Match this data type with the data type of the UDP packets sent by the remote host.

Specify the duration of time to wait for a UDP packet before returning control to the scheduler for each sample.

Specify how often the scheduler runs this block.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2019a