When using java to receive a Multicast address I get a failed exception.

18 Ansichten (letzte 30 Tage)
Bart
Bart am 29 Aug. 2017
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.

Antworten (0)

Kategorien

Mehr zu Call Java from MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by