A JSON file of Motion Capture data is being broadcast from a URL powered by a NodeJS package called WS.
I’ve been given the URL and Port. I’m able to connect a Socket: socket.isConnected() returns true.
When I try to create an InputStream and an InputStreamReader, the isReady() function of InputStreamReader returns false. Attempts to read a single int hang.
I also tried DataInputStream just to see if there was anything and available() function of DataInputStream returns false. Attempts to read a single int hang.
I’m new enough at this that there could be something really basic that I am missing. Any thoughts? Also, I am at a loss as to how to proceed to troubleshoot this.
Socket socket = new Socket(); InetSocketAddress socketAddr = new InetSocketAddress("192.168.1.189", 9100); socket.connect(socketAddr, 10_000); System.out.println("socked connected:" + socket.isConnected()); System.out.println(" URL:" + socket.getInetAddress()); System.out.println(" port:" + socket.getPort()); InputStream inRT = socket.getInputStream(); // InputStreamReader isrRT = new InputStreamReader(inRT, "UTF-8"); // System.out.println("ISReader is ready:" + isrRT.ready()); // int n = isrRT.read(); DataInputStream disRT = new DataInputStream(inRT); System.out.println("DIS available:" + disRT.available()); int n = disRT.readInt(); System.out.println("n:" + n); socket.close();
socked connected:true URL:/192.168.1.189 port:9100 DIS available:0
An elaborate work-around might be possible. It would involve tapping into the broadcast from the application that reads the MoCap data (Axis-Neuron). I can read data from this application if the motion data is sent out as text, but another user needs the data broadcast as binary, and only one broadcast is available. To use the binary, I would have to find and code from a spec–which maybe will be necessary if I can’t connect to the location streaming the JSON data.