UDP Send

Send UDP packets to UDP host

  • Library:
  • Embedded Coder Support Package for STMicroelectronics Discovery Boards/STM32F746G-Discovery

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 or the host name to which the block sends the UDP packets. 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.

See Also

Introduced in R2017a