server.read

edited March 2017 in Library Questions

Hello everybody, I am using this code but processing says that the function server.read is not available. Anybody knows how I can do a server which can read data from a client?

Thank you very much for your help!

// Import the net libraries import processing.net.*; // Declare a client Server server; // The data we will read from the server int data;

void setup() { size(200,200);

server = new Server(this, 5204);

}

void draw() {

// Read data server.read(data);

// The incoming data is used to color the background.

background(data);

}

// The serverEvent function is called whenever a new client connects. void serverEvent(Server server, Client client) { println(" A new client has connected: "+ client.ip()); }

Answers

  • edit post, highlight code, press ctrl-o to format...

  • Please check the reference for examples to accessing data via network. Check the library section >> Network.

    Kf

  • Answer ✓

    It was a sintaxical problem the good way to do it is client.read(data). Thank you for your help

Sign In or Register to comment.