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

3 次查看(过去 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 CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by