what to do when i run the matlab coding it show "configuremulticast" is supported only on "windows in the command window

1 回表示 (過去 30 日間)
clc;
clear all;
uSender = udpport()
uReceiver1 = udpport("datagram", "LocalPort", 3030, "EnablePortSharing", true)
uReceiver2 = udpport("LocalPort", 3030, "EnablePortSharing", true)
configureMulticast(uReceiver1, "226.0.0.1");
configureMulticast(uReceiver2, "226.0.0.1");
uReceiver1.MulticastGroup
uReceiver1.EnableMulticast
uReceiver2.MulticastGroup
uReceiver2.EnableMulticast
write(uSender,"Hello world! Together we fight #covid-19!","string","226.0.0.1",3030);
uReceiver1Count = uReceiver1.NumDatagramsAvailable
uReceiver2Count = uReceiver2.NumBytesAvailable
data1 = read(uReceiver1,uReceiver1Count,"string");
data1.Data
data2 = read(uReceiver2,uReceiver2Count,"string")
configureMulticast(uReceiver1, "off");
configureMulticast(uReceiver2, "off");
clear uReceiver1;
clear uReceiver2;
clear uSender;

採用された回答

Walter Roberson
Walter Roberson 2021 年 1 月 21 日
you are correct that new function is only available for windows.
https://www.mathworks.com/help/instrument/udpport.configuremulticast.html
but see https://www.mathworks.com/matlabcentral/answers/56534-does-matlab-support-udp-multicast#answer_239823

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by