UDP Send

Send UDP packets over the Ethernet link between development and target computers


Simulink® Real-Time™ Library for Legacy UDP


The UDP Send block sends a byte stream (represented as a uint8 vector) to the UDP board. Use the Byte Packing block to convert from the signal data type to a single vector of uint8 values.

IP fragmentation is not supported in Simulink Real-Time UDP blocks. The packet payload is limited to 1472 bytes (1500 bytes UDP packet size − 28 bytes combined packet header size).

Block Inputs



Vector of uint8 containing data to send

Block Parameters

IP address to send to

Specify the IP address to send the packet. Enter a valid IP address as a dotted decimal string. For example, You can also use a MATLAB® expression that returns a valid IP address as a string.

Remote IP port to send to

Specify the port to which to send the packet. This value must match the IP port to receive from parameter of the UDP Receive block

Use the following local IP port

Set this parameter to -1 (default) to allow the networking stack to automatically determine the local IP port that is used for sending. Otherwise, specify a particular port to send a packet from that port.

Allow variable length packets

Select this check box to enable the sending of variable length messages. Selecting this check box enables a second input port.

The width of the first signal entering the first input port specifies the maximum length of the input message. If this check box is selected, the first input port receives the actual data, and the second input port receives the actual length of the message.

If this check box is cleared, the block sends all the data each time.

Sample time

You can set this parameter to -1 for an inheritable sample time, but you should set this parameter to some specific (large) value to eliminate chances of dropped packets. This is especially true when you are using a small base sample time.

See Also


External Websites

Was this topic helpful?