UDP Send

Send UDP packets to UDP host

  • Library:
  • Simulink Coder Support Package for STMicroelectronics Nucleo Boards

Description

The UDP Send block sends an input vector as UDP packets over an IP network port to a UDP host. Use the block for stateless and connectionless data transmission.

The block sends packets from the port number specified in the Local IP Port (-1 for automatic port assignment) parameter.

Specify the IP address and the port number of the receiving host in the Remote IP address (255.255.255.255 for broadcast) and Remote IP Port parameter.

You can choose to send the UDP packets in blocking or non-blocking mode.

Ports

Input

expand all

The port accepts an array and sends it as UDP packets over an IP network port to the receiving host.

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

Parameters

expand all

Specify the IP address to which the block sends the UDP packets. This parameter does not accept host name as input.To broadcast packets to all the receiving hosts, specify 255.255.255.255.

Specify the port number of the application on the receiving host to which you want to send the packets. Match the remote port number with the local port number of the receiving host.

Specify the port number of the application from which you want to send the packets.

The default value, -1, sets the local port number to a random available port number and uses that port to send the packets. If the receiving host expects UDP packets from a particular port number, specify that number.

  • on — When you select this parameter, the send operation runs in the Blocking mode. If packet received in the previous time step is sent, the block accepts data from the input port. If the send operation is in progress, the block waits for the packet to be sent, and then it accepts data from the input port.

    If the connection between the sending and the receiving host is not established, or if the connection is lost, the data at the input port is dropped.

    A task overrun occurs if the target hardware is still waiting for the requested data to be sent when the next send operation is scheduled to begin. To fix overruns:

    • Increase the sample time of input data.

    • Reduce the length of data at the input port.

  • off — When you clear this parameter, the send operation runs in the Non-blocking mode. When sending packets, if the transmission of the packets received in the previous time step is still in progress, the data at the input port at the given time step is dropped.

    If the connection between the sending and the receiving host is not established, or if the connection is lost, the data at the input port is dropped.

Specify the amount of time (seconds) that the block waits for the data to be available during each time step. If timeout occurs, the read operation is aborted.

Dependencies

This output is available only if the Wait until data received option is checked.

Select this option to display the error status during data transmission.

When you select the Output error status parameter, the block configures an output port. The port on the block is labeled as Status, indicating that the block outputs the status of the read operation at the output port.

Model Examples

See Also

Introduced in R2017a