Is it possible to connect to an UDP multicast using the Instrument Control Toolbox?

I would like to make a connection to UDP multicast using the Instrument Control Toolbox. Is it possible to do so?

 채택된 답변

In R2020b, the "configureMulticast" feature was added, enabling UDP multicast. 
If you are using R2020a or an earlier version, please read the following.
---------------------------------------
The ability to connect to a UDP multicast is not available in the Instrument Control Toolbox.
As a workaround to connect to a UDP multicast, you can do the following:
1. Use a Java multicast socket to access it directly from MATLAB. For more information, see javadoc or tutorials for the "core java.net" classes from Sun, specifically "java.net.MulticastSocket ". This could be found at:
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/MulticastSocket.html
Information on using Java with MATLAB in the 'External Interfaces' section of the MATLAB documentation can be accessed by typing the following command at the MATLAB command prompt:
web([docroot,'/techdoc/apiref/ch00intr.html'])
2. Write your own functions in C that use standard sockets and have a MEX wrapper call those functions. You can find more information on MEX-files at:
https://www.mathworks.com/help/matlab/call-mex-files-1.html
If you are using MATLAB between R2016b and R2020a, you can take a look at this example:
https://www.mathworks.com/matlabcentral/fileexchange/59156-udp-broadcasting-from-matlab
This achieves the goal of multiple devices on the same subnet, whose IP addresses are not known at the time of development of the MATLAB program, to receive messages from the MATLAB program.

추가 답변 (1개)

Vinod
Vinod 2016년 10월 19일
편집: MathWorks Support Team 2023년 4월 27일
If you are using MATLAB R2016b or newer, take a look at this example: https://www.mathworks.com/matlabcentral/fileexchange/59156-udp-broadcasting-from-matlab
Technically it is UDP broadcast, but it achieves the need of multiple devices on the same subnet, whose IP addresses are not known at the time of development of the MATLAB program, to receive messages from the MATLAB program.

카테고리

도움말 센터File Exchange에서 External Language Interfaces에 대해 자세히 알아보기

제품

릴리스

R14SP2

Community Treasure Hunt

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

Start Hunting!

Translated by