oscP5 library, sending data with network

what do you mean exactly?? This one??

String [] myFileString;
 myFileString = loadStrings ("data.csv");

I also tried loadStrings and join the String[] array and putting the variable joinedData into myMessage.add(joinedData)

String joinedData = join(myFileString, "\n"); 

But when i send the data from Android to PC the console shows me the error bellow:

[2018/10/14 12:37:34] ERROR @ UdpServer.run() ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException

I thought that the problem was that the data are too many( the csv file is about 6000 lines and 181MB).
After that i tried to load a smaller csv file( about 50 lines and 0,5KB) and it worked perfect…
But the purpose is to load and send the big file (about 6000 lines and 181MB).

181MB?

OSC is absolutely not designed to send a single 181MB message. Depending on the implementation you might be looking at a max message size of e.g. 1MB – or less.

Java can in theory build a string up to 2147483647 characters (2GB) but your sketch may not be happy about joining a 100+MB String, and you might hit combined memory overhead long before that.

Your error mentions UdpServer.run(). I believe that UDP will not send a packet larger than 65,507 bytes (65 kilobytes, or 0.06MB). If you have 181MB in 6000 rows then it sounds like you have about 30 kilobytes, or 0.03MB (~1000 chars) per row? That row will fit in a UDP packet – in an OSC message. If some of your rows are much longer than others than you might still hit a limit – then you would have to break long rows up or send fields (or use TCP).

As I said in my message of Sep 5, you should probably loop over your rows and send them one at a time – 6000 messages, with ids. Write them into an array as you receive them on the other side.

2 Likes

Could you please be more specific @jeremydouglass ???I thought that i have done the first four things of your message of Sep 5…So i think i have to give each row an ID which i don’t know how to do it and then receive and parse them…???