Socket Binding Error in Simulink

7 views (last 30 days)
Mike Powell
Mike Powell on 5 Feb 2014
I have a Simulink model that receives data over a UDP port. It receives successfully when I send from one Simulink model to another, but it cannot bind the port when I try to send from a Unity program if the Unity program was started first. If the Unity program is not running, I can run my Simulink model until it reaches a timeout waiting for packets. If the Unity program is running at model start, I instantly get the following error:
Error evaluating registered method 'Start' of MATLAB S-Function 'sudprb' in 'model_name/UDP Receive'.
Caused by:
Unsuccessful open: Unrecognized Windows Sockets error: 0: Cannot bind
I have a JAVA test program that can receive the data via the same UDP port while the Unity program is running. When Unity has first access to the port, it appears to block MATLAB, but allow JAVA to receive packets. If MATLAB has first access to the port, I can send from a Simulink model to itself without disruption even if I start my Unity program immediately. Any ideas how to allow Simulink to access this UDP port to retrieve data originated in and sent by Unity? Thanks.

Answers (0)

Categories

Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!