If you just need to read a single byte and do something depending on its value the basic sequence is this:
loop()
{
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char ch = client.read();
// examine ch
switch(ch)
{
case '0': // for example
// switch LED off
break;
// add other cases
}
// send the response and close the connection
client.println("OK");
delay(1);
client.stop();
}
}
}
}
You'll notice this is the same sequence of zoomkat's example. If you want to send and read commands as strings, zoomkat's is the solution you are looking for.