How to select Ethernet connection for UDP send/receive
7 views (last 30 days)
Show older comments
Hello,
I'm trying to send and receive data over ethernet (UDP) using a second ethernet adapter on my workstation. As a standard, Simulink always sends data over the Built-in Ethernet. Since this is connected to a VPN network, my counterpart cannot receive the data.
Is it possible to define the Ethernet connection, that should be used for the UDP send/ recieve Block to commnicate with?
I've tried the UDP send from the "DSP System Toolbox - 2", from the "Instrument Control Toolbox -2" as well as the UDP send from the "Simulink Reatime - 8" Blockset. I was not succesful.
I really would appreciate any idea how to solve this - thank you in advance
Christian
0 Comments
Answers (2)
Walter Roberson
on 2 Nov 2022
As a standard, Simulink always sends data over the Built-in Ethernet.
No, as a standard, Simulink relies on the operating system to send the data. The operating system chooses the adapter according to the IP address of the destination and according to the configuration of the ethernet interfaces.
When there are multiple physical interfaces, they are typically configured with different subnet ranges, and the destination interface is chosen according to the subnet. If they are configured with the same subnet range and the destination is in the same subnet, then the operating system sets out IPv4 ARP packets and hopes for something to rely with the MAC address to use; the operating system then sends out according to which interface the reply came through.
In most cases, VPNs are configured to not translate for local addresses; that is something that is part of the VPN exception list.
If you have VPN software that is deliberately configured to translate local addresses, then that is a matter of Policy being imposed by your IT staff, and in such a case, connecting to a local device through Simulink would be in violation of policy; you would need to get your IT staff to make an exemption to connect to the device if that is your situation.
There is an exception to all of this, a case where Simulink does (in practice) choose which interface to use. That exception is if you are using Simulink Real-Time; see the discussion at https://www.mathworks.com/matlabcentral/answers/1765995-real-time-udp-send-and-receive-block?s_tid=srchtitle
See Also
Categories
Find more on Development Computer Setup 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!