We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsWebsite,  Documentation,  Book Bugs › Net library refrence 'bugs'
Page Index Toggle Pages: 1
Net library refrence 'bugs' (Read 1387 times)
Net library refrence 'bugs'
Jun 13th, 2005, 5:16pm
 
Hi! This is a little list of things that i found missing or wrong in the Net library reference:

In the method/event list:
There says "Client()" and shoud say "Client"

In the "Client.available()":
The description is not clear enough, is it the number of available bytes from the server? (i think so)

For the "Server.available()" method here is an example:
Code:


import processing.net.*;


Server myServer;

int port = 10002;


void setup() {

myServer = new Server(this, port);

}


void draw() {

Client remoteClient = myServer.available();

if(remoteClient != null) {

String message = remoteClient.readStringUntil(RETURN);

if (message != null) {

myServer.write("The client " + remoteClient.ip() + " wrote " + message);

}

}

}



For the "stop()" method, here is an example:
Code:


import processing.net.*;


Server myServer;

int port = 10002;

int counter;


void setup() {

myServer = new Server(this, port);

}


void draw() {

counter++;


if(counter < 1000) {

myServer.write(counter);

} else {

myServer.stop();

}

}



For the "disconnect()" method, here is an example:
Code:


import processing.net.*;


Server myServer;

int port = 10002;


void setup() {

myServer = new Server(this, port);

}


void draw() {

Client remoteClient = myServer.available();

if(remoteClient != null) {

int message = remoteClient.readStringUntil(RETURN);

if (message == 255) {


myServer.disconnect(remoteClient);

}

}

}

Re: Net library refrence 'bugs'
Reply #1 - Jan 30th, 2006, 2:29pm
 
Hy!

What do i need to put in the write method,
to get readStringUntil(RETURN) working.

i.e.: with what do i need to end string?
Page Index Toggle Pages: 1