oscP5 UdpServer.run() ArrayIndexOutOfBoundsException
in
Integration and Hardware
•
11 months ago
Hi there! I'm having a problem with using oscP5. I'm trying to send some stuff from a C++ program to processing.
For the sending part, I'm using oscpack, and the following C++ code:
- #include "osc/OscOutboundPacketStream.h"
- #include "ip/UdpSocket.h"
- #define ADDRESS "127.0.0.1"
- #define PORT 7000
- #define OUTPUT_BUFFER_SIZE 1024
- int main(int argc, char* argv[])
- {
- UdpTransmitSocket transmitSocket( IpEndpointName( ADDRESS, PORT ) );
- char buffer[OUTPUT_BUFFER_SIZE];
- osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE );
- p << osc::BeginBundleImmediate
- << osc::BeginMessage( "/test1" )
- << true << 23 << (float)3.1415 << "hello" << osc::EndMessage
- << osc::BeginMessage( "/test2" )
- << true << 24 << (float)10.8 << "world" << osc::EndMessage
- << osc::EndBundle;
- transmitSocket.Send( p.Data(), p.Size() );
- }
When I'm running the oscpack receiver demo (SimpleListener), the message arrives without any problems.
However, when I try to listen in processing, the following error occurs whenever I send something:
ERROR @ UdpServer.run() ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException
I tried to make the datagramsize bigger, but to no avail. This is my processing code:
- import oscP5.*;
- import netP5.*;
- OscP5 oscP5;
- void setup() {
- size(400,400);
- frameRate(25);
- OscProperties properties = new OscProperties();
- properties.setListeningPort(7000);
- properties.setDatagramSize(99999999);
- oscP5 = new OscP5(this, properties);
- }
- void draw() {
- background(0);
- }
- /* incoming osc message are forwarded to the oscEvent method. */
- void oscEvent(OscMessage theOscMessage) {
- /* print the address pattern and the typetag of the received OscMessage */
- print("### received an osc message.");
- print(" addrpattern: "+theOscMessage.addrPattern());
- println(" typetag: "+theOscMessage.typetag());
- }
From looking at the oscP5 code I' m thinking it can only be the datagram size but I set that to really high. So does anyone know what's going on? Or has another idea on how to send data from C++ to processing? I'm really desperate :/
1