Sending Live data from Processing to Grasshopper


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

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 ("", 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() {

  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

  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,

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():

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