Main Content

UDP Send

Send data over UDP network to a remote device

  • Library:
  • Simulink Real-Time / IP

  • UDP Send block

Description

The UDP Send block sends data over a UDP network to a remote device. The block can send data by using the connection between the development and target computers or by using a dedicated Ethernet card. If you use a dedicated Ethernet card, use the Speedgoat configuration utility to configure the dedicated Ethernet board.

The parameter Local IP address applies when the block executes in a real-time application on a target computer or in a model simulation on a development computer. If your model is running in Simulink® on the development computer, you can use this block to transmit data to a remote device. In this case, the Windows® operating system determines the network connection.

To broadcast to all devices on the local subnetwork, set To IP address to 255.255.255.255. Otherwise, set To IP address to a valid IP address.

Ports

Input

expand all

Vector of uint8 containing data to transmit over the UDP network. To determine how many bytes of data to transmit, use the Length input port.

Data Types: uint8

Determines the number of bytes of data to transmit. Specify the width of the Data vector as the maximum number of bytes that you expect to transmit.

Parameters

expand all

Dependency

When you select this parameter, it deactivates the Local IP address parameter and excludes the ports 1 through 1023 and 5500 through 5560 from use by UDP.

Programmatic Use

Block Parameter: useHostTargetConn

When Local IP address is set to Use host-target connection, the block uses the connection between the development and target computers. When To IP address is specified as a multicast address, the local IP address is used to determine the outbound interface over which multicast datagrams are sent. If the Local IP address is set to IP address 0.0.0.0, the target computer RTOS determines the outbound interface for sending multicast messages.

Ports 1 through 1023 and 5500 through 5560 are reserved for Simulink Real-Time communications.

Programmatic Use

Block Parameter: ipAddress

Specifies local UDP port to transmit data.

Ports 1 through 1023 and 5500 through 5560 are reserved for Simulink Real-Time communications.

The value −1 means that the block transmits data by using any available port.

Programmatic Use

Block Parameter: localPort

Specifies IP address of target device. To broadcast to all devices on the local subnetwork, send to 255.255.255.255.

Programmatic Use

Block Parameter: toAddress

Specify the UDP port of target device. With To IP address, this parameter defines the destination of the data transmission.

Programmatic Use

Block Parameter: toPort

Enter the base sample time or a multiple of the base sample time.

Programmatic Use

Block Parameter: sampleTime
Introduced in R2020b