Main Content

UDP Receive

Receive UDP message from UDP host

  • Library:
  • Simulink Support Package for Parrot Minidrones

  • UDP Receive block

Description

TheUDP Receiveblock receives UDP message from a UDP host.

The block output,Data作为一维vecto,发出UDP数据包数据r of a specified data type. The block output,Size, emits the size of the data in the UDP buffer. With each sample, the block outputs the bytes of a UDP message as a data vector of the size specified by theData size (N)parameter.

The data type of the block output,Data, depends on theData typeparameter. The data type of the block output,Size, isuint16.Sizerepresents the total bytes. For example, if theData Typeis double and the number of elements (mentioned using theData size (N)parameter) is 5, then the value ofSizeis 40, that is, 8*5 bytes.

The block receives the message on the port number specified in theLocal IP portparameter. Match the port number specified in theLocal IP portparameter with the remote port number of the sending host.

Parrot®minidrone is a little-endian device. TheUDP Receiveblock expects the byte order of the received UDP data to be little-endian.

Note

If you are having trouble using UDP to communicate with a computer, the antivirus or firewall software might be blocking UDP traffic. If so, configure the software to allow the traffic for a specific IP port number.

Ports

Output

expand all

At each sample time, the port outputs the data bytes of a message received as a data vector of the size specified by theData size (N)parameter.

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

At each sample time, the port outputs the number of data bytes in the received message.

Data Types:uint16

Parameters

expand all

Specify the port number of the application on which you want to receive messages. Match the local port number with the remote port number of the sending host.

Note

Do not use ports24099and26061for UDP communication with Parrot minidrone as these ports are reserved.

Select the data type of the bytes to be received from the sending host.

Specify the number of data bytes that you want to receive in each message.

Enter the time interval at which to receive data.

When you set this parameter to-1, Simulink®determines the best sample time for the block based on the block context within the model.

Version History

Introduced in R2018a

See Also