
LOOK, MA, NO COMPUTER! 145
Continued from opposite page.
Client speakingClient = myServer.available();
// if the client is not null, display what it sent:
if (speakingClient !=null) {
String whatClientSaid = speakingClient.readString();
// print who sent the message, and what they sent:
println(speakingClient.ip() + "\t" + whatClientSaid);
}
}
// ServerEvent message is generated when a new client
// connects to the server.
void serverEvent(Server myServer, Client someClient) {
println("We have a new client: " + someClient.ip());
thisClient = someClient;
}
void keyReleased() {
// only send if there's a client to send to:
if (thisClient != null) {
// if return is pressed, send newline and carriage feed:
if (key == '\n') {
thisClient.write("\r\n");
}
// send any other key as is:
else {
thisClient.write(key);
}
}
}
Whether you’re connecting from a
serial terminal program or have
programmed a microcontroller to
make the connection, you can use this
program to test whether the Lantronix
module is making a successful con-
nection. Once you’ve seen messages
coming through to this program in
the right sequence, just change the
connect string in your microcontroller
code to the address of the web server
you want to connect to, and everything
should work fine. If it doesn’t, the
problem is most likely with your web
server. Contact your service provider ...