MATLAB: Using UDP in Simulink Real-Time, why do I get a Bind Failed Error

Using UDP in Simulink Real-Time, why do I get a Bind Failed Error?

Best Answer

There are different Bind Failed Error causes, distinguished by their Error Codes:
Error 10013:
This error can occur if the port is already in use.
Try changing the port number to something else (recommended range [1024 65535]) since ports < 1024 can sometimes be reserved.
Error 1 (204):
This error can be caused by the Real-time UDP Configuration block executing after a UDP Send/Receive Block.
Confirm this by viewing the block execution order (Display -> Blocks -> Sorted Execution Order).
To ensure that the UDP Configuration Block executes first, set the Priority (right click -> Properties) on the corresponding blocks.
Note that a lower priority causes a block to be executed first.
If you encounter a Bind Failed Error not listed here, please contact MathWorks Technical Support.