Network: TCP speed is too slow
in
Core Library Questions
•
1 year ago
I want to read data from a Wifi module using TCP and plot in Processing. Right now I am just sending a loop of counter values (from 0 to 1000) from the other end. The code in my Processing takes around 16660 milliseconds to read 1000 values. I checked in the Hyperterminal, which reads the data lot faster. Why is it so slow?
I tried to check which part is causing the delay but couldn't figure out.
Here is my code:
-
import processing.net.*;Client myClient;
int count = 0;byte[] inBuffer = new byte[10];int nl = 10;
void setup() {size (400, 300);background(0);myClient = new Client(this, "169.254.1.1", 2000);int m = millis();}
void draw(){if (myClient.available() > 0){myClient.readBytesUntil(nl, inBuffer);String s = new String(inBuffer);println( s);
count++;if (count ==1000){println("Time = " + (millis() - m));delay(1000);m= millis();count = 0;}}}
1