Send UDP message
The UDP Send block transmits an input vector as a UDP message over an IP network port. The remote IP port number to which the block sends the UDP packets is tunable in the C/C++ generated code.
Some Simulink® blocks and
Specify the IP address or hostname to which the block sends
the message. To broadcast the UDP message, retain the default value,
Specify the port to which the block sends the message. This
parameter is tunable in the C/C++ generated code but not tunable during
simulation. The default is
25000. The value can
be in the range [1 65535].
Note: On Linux®, to set the IP port number below 1024, run MATLAB with root privileges. For example, at the Linux command line, enter:
To let the system automatically assign the port number, select
automatically. To specify the IP port number using the Local
IP port parameter, select
Specify the IP port number from which the block sends the message.
If the receiving address expects messages from a particular port number, enter that number here.
Usage notes and limitations:
The executable generated from this block relies on
prebuilt dynamic library files (
.dll files) included
with MATLAB. Use the
packNGo function to
package the code generated from this block and all the relevant files
in a compressed zip file. Using this zip file, you can relocate, unpack,
and rebuild your project in another development environment where MATLAB is
not installed. For more details, see How To Run a Generated Executable Outside MATLAB.
The Remote IP port parameter
is tunable in the generated code, but not tunable during simulation.
You can control the parameter tunability in the generated code through
several ways. One of the ways is to configure the parameter as a tunable
field of a global structure in the generated code. Other ways include
applying a built-in storage class or custom storage class to a
and using this object to set the value of the block parameter. For
details, see Block Parameter Representation in the Generated Code (Simulink Coder).