it appears to be working, sort of.
Code:
import processing.net.*;
int port = 9999;
Server myServer;
void setup() {
size(400, 400);
background(0);
myServer = new Server(this, port); // Starts a server on specified port
}
void draw() { }
void serverEvent(Server someServer, Client someClient) {
println("We have a new client: " + someClient.ip());
myServer.write("200 OK");
myServer.write("Content-type: text/plain");
myServer.write("Thankyou.");
}
The first problem is that the webpage does not receive the answer, or the answer isn't well formated or something, it just gives a timeout after a while, but I think I can work around that.
The other problem is more serious: I've looked into the NET docs and there is no READ command for the server, although there is a WRITE command for the client. I tried the examples in the docs, and the example for the client.write doesn't give any error but doesn't affect the server in any way either (wich is normal, the server doesn't have a read command in it).
So the question is, how do I retrieve information on the server from the web page ?
Thanks.