# oscP5 library, sending data with network

**URL:** <https://discourse.processing.org/t/oscp5-library-sending-data-with-network/3244>\
**Category:** Processing for Android\
**Created:** [September 4, 2018, 9:45am UTC](https://discourse.processing.org/t/oscp5-library-sending-data-with-network/3244 "2018-09-04T09:45:25Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![netphysicist](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@netphysicist](https://discourse.processing.org/u/netphysicist)\
**Post date:** [October 14, 2018, 9:46am UTC](https://discourse.processing.org/t/oscp5-library-sending-data-with-network/3244/22 "2018-10-14T09:46:41Z")

</div>

what do you mean exactly?? This one??

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

```

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

```auto
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

---

<div class="post-metadata">

**Author:** ![netphysicist](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@netphysicist](https://discourse.processing.org/u/netphysicist)\
**Post date:** [October 14, 2018, 9:55am UTC](https://discourse.processing.org/t/oscp5-library-sending-data-with-network/3244/23 "2018-10-14T09:55:21Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [October 14, 2018, 6:37pm UTC](https://discourse.processing.org/t/oscp5-library-sending-data-with-network/3244/24 "2018-10-14T18:37:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![netphysicist](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@netphysicist](https://discourse.processing.org/u/netphysicist)\
**Post date:** [October 16, 2018, 12:40pm UTC](https://discourse.processing.org/t/oscp5-library-sending-data-with-network/3244/25 "2018-10-16T12:40:11Z")

</div>

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…???

[Previous page](https://discourse.processing.org/t/oscp5-library-sending-data-with-network/3244.md?page=1)
