Main Content

UDP Read

Receive UDP packets from remote host

  • UDP Read block

Libraries:
SoC Blockset / Processor I/O
SoC Blockset / Host I/O

Description

The UDP Read block receives UDP (User Datagram Protocol) packets from a remote host on the application on target. The remote host is the computer or hardware from which you want to receive UDP packets. The block reads UDP packets from UDP socket buffer and returns the UDP packets as a one-dimensional array.

Ports

Input

expand all

This message port receives UDP packets, as messages, from a connected IO Data Source block. The messages process when the Task Manager block triggers task containing the UDP Read block. For more information on messages, see Messages.

Note

This input is used only during simulation. and does nothing in code generation and external mode simulation.

Data Types: SoCData

Output

expand all

Output UDP packet, received from a remote host, returned as a numeric vector.

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

Length of output UDP packet returned on the output data port.

Data Types: uint32

Parameters

expand all

Specify the port number of the application on target in which you want to receive data. Match the local IP port number with the remote IP port number of the remote host.

Select the type of data the block receives from the sending host. Match the data type with data type of input data.

Specify the maximum number of data elements that the output data port can produce at every time step.

Specify the maximum number of data bytes that the block can receive at each time step.

To generate event-driven code, select this parameter. To generate timer-driven code, clear this parameter.

When Enable event-based execution is selected, the block reads data from the socket buffer whenever any UDP data is received in the socket buffer irrespective of the sample time. When Enable event-based execution is cleared, the block reads available UDP data from the socket buffer at each sample time. To set the size of the data that the block can read from the socket buffer, specify the size in the Receive buffer size parameter.

Specify how often the scheduler runs this block. If this value is -1 (default), the scheduler assigns the sample time for the block.

Extended Capabilities

Version History

Introduced in R2019a