Socat is a unix utility for bidirectional data transfer and redirection. It is used for lot of different things, but I'm using it to listen to a port on a server and redirect input to/from a USB device. Here is info on socat:
http://www.dest-unreach.org/socat/doc/socat.html
After a little more troubleshooting, I find that my problem is not really related to Android at all. Something similar happens in Java mode. Here is some stripped down code:
- import oscP5.*;
- import netP5.*;
- OscP5 op5;
- void setup() {
- op5=new OscP5(this,"192.168.0.15",1234, OscP5.TCP);
- }
- void draw() {
- background(0);
- }
- void mousePressed() {
- OscBundle bndl = new OscBundle();
- OscMessage msg = new OscMessage("/TEST");
- msg.add("text");
- msg.add(100);
- bndl.add(msg);
- op5.send(bndl);
- }
This does in fact send the test OSC bundle to my remote server:port. The initial message is redirected by socat to the configured USB port, and my target device correctly parses the message, but the sketch then crashes, be it in java or android. Here is the java error that is returned:
java.lang.NullPointerException
at processing.mode.java.runner.Runner.findException(Runner.java:947)
at processing.mode.java.runner.Runner.reportException(Runner.java:892)
at processing.mode.java.runner.Runner.exceptionEvent(Runner.java:818)
at processing.mode.java.runner.Runner$2.run(Runner.java:707)
Anybody have an idea? Like I said, this same code works when configured for udp transmission, but I'd prefer a handshaking protocol. Obviously the handshaking requirement must be causing my problems. Am I missing something in my processing sketch to get a tcp client to work?