# Sending Live data from Processing to Grasshopper

**URL:** <https://discourse.processing.org/t/sending-live-data-from-processing-to-grasshopper/26473>\
**Category:** Libraries\
**Created:** [December 23, 2020, 2:06pm UTC](https://discourse.processing.org/t/sending-live-data-from-processing-to-grasshopper/26473 "2020-12-23T14:06:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DariaSuzanne](https://avatars.discourse-cdn.com/v4/letter/d/4bbf92/32.png) [@DariaSuzanne](https://discourse.processing.org/u/DariaSuzanne)\
**Post date:** [December 23, 2020, 2:06pm UTC](https://discourse.processing.org/t/sending-live-data-from-processing-to-grasshopper/26473/1 "2020-12-23T14:06:46Z")

</div>

Hello

I have recently learned that you can send data from processing to various softwares. I was wondering if anyone has any idea about an error I keep encountering:

_[2020/12/23 14:0:59] ERROR @ UdpClient.send ioexception while sending packet. java.net.SocketException: The message is larger than the maximum supported by the underlying transport: Datagram send failed_  
I think it has to do with something with my code in Processing, as it appears without having Rhino/Grasshopper open  
Any help will be greatly appreciated!!

I will leave the code below.

```auto
import oscP5.*; 
import netP5.*;

OscP5 oscP5; 
NetAddress myRemoteLocation;
OscMessage arrayMsg = new OscMessage ("/array"); 
String message; 

int nX=width/2; //array length at X
int nY=height/2; //array length at Y
PVector [][] myArray=new PVector[nX][nY]; 

void setup() {  
  size(500, 500);
  oscP5 = new OscP5 (this, 12000); //12000 is a random number
  myRemoteLocation = new NetAddress ("192.168.0.53", 12001); //"localhost" is for sending to my own PC. 
  //To send over ethernet or other devices you have to enter an IP number.

  for (int i=0; i<nX; i++) { //fill in the array //in this case with random numbers
    for (int j=0; j<nY; j++) {
      myArray[i][j]=new PVector(random(i*20, (i+3)*20), random(j*20, (j+3)*20));
    }
  }
}

void draw() {

  background(0);
  OscMessage arrayMsg = new OscMessage ("/array"); 

  for (int i=0; i<nX; i++) {
    for (int j=0; j<nY; j++) {

      ellipse(myArray[i][j].x, myArray[i][j].y, 2, 2); 
      //message += "{"; +
      message = String.valueOf(myArray[i][j].x) + "," +  
      String.valueOf( myArray [i][j].y) + "," + 
      String.valueOf(myArray [i][j].z) + "}";
      arrayMsg.add(String.valueOf(myArray [i][j].x)) ; 
      arrayMsg.add(String.valueOf(myArray [i][j].y)) ; 
      arrayMsg.add(String.valueOf(myArray [i][j].z)) ; 
      
      //if (j<nY) message+="*"; //this places a "*" between points of the same row
    }
    //if (i<nX) message+="&"; //this places a "&" between points of different columns
  }

  arrayMsg.add(message); 
  oscP5.send(arrayMsg, myRemoteLocation);
}

void keyPressed() { //this is to check refresh rate. press a key to reset array values
  for (int i=0; i<nX; i++) {
    for (int j=0; j<nY; j++) {
      myArray[i][j].set(random(i*20, (i+1)*20), random(j*20, (j+1)*20), 0);
    }
  }
}

```

Thank you,

---

<div class="post-metadata">

**Author:** ![noahbuddy](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@noahbuddy](https://discourse.processing.org/u/noahbuddy)\
**Post date:** [December 24, 2020, 8:33am UTC](https://discourse.processing.org/t/sending-live-data-from-processing-to-grasshopper/26473/2 "2020-12-24T08:33:39Z")

</div>

Based on the error, it seems you are hitting the limit of the UDP packet length.  
If memory serves, that is 65536 bytes (including header).

Maybe try a small data set?

If that is the limitation, probably have to break your data into blocks (maybe a column at a time) and send those.

Also, if your goal is to use your sketch’s width and height, add these after calling size():

```auto
nX=width/2; //array length at X
nY=height/2; //array length at Y

```
