When using java to receive a Multicast address I get a failed exception.
20 次查看(过去 30 天)
显示 更早的评论
I am trying to receive multicast data in Matlab, but am using Java code because Matlab is unable to receive Multicast data. I am using the following code but when trying to join the group I get an exception.
import java.io.*;
import java.io.DatagramSocket;
import java.io.DatagramPacket;
import java.io.InetAddress;
import java.io.MulticastSocket;
addr = InetAddress.getByName(‘235.1.1.1’);
socket = MulticastSocket(8100);
socket.setSoTimeout(5000);
socket.setReuseAddress(1);
socket.joinGroup(addr);
When I try to join the group I get the following exception.
Java exception occurred: java.net.SocketException: No such device at java.net.PlainDatagramSocketImpl.join(Native Method) at java.net.AbstractPlainDatagramSocketImpl.join(Unknown Source) at java.net.MulticastSocket.joinGroup(Unknown Source)
This code has been pulled from other sources on the web so I feel like something is configured correctly. When I run java –version in Matlab I get Java 1.7.0_60-b19.
I was unable to copy and paste the code, but I think I typed it in correctly so if there is a syntax error that may be why.
This code is run on Red Hat 7.3 and Matlab 2016a.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Java from MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!