The Ethernet shield's 4 connections....

Does the fact that there may be 4 connections, mean I can run more than one server?

If so, do I simply double up these lines:

EthernetServer server(8085); //server port
server.begin();

.... like this?

EthernetServer server(8085); //server port
server.begin();
EthernetServer server2(8086); //server port 
server2.begin();

Or do I have the stick by the wrong end again?

TIA,

Jim

Yes you can, and that is correct.
http://forum.arduino.cc/index.php?topic=151224.msg1135615#msg1135615

Thanks ST....

Glad you posted that code there, becasue my inclination would have been to make these:

// check port 80
EthernetClient client = server.available();
if(client) {
  // do port 80 page
}

// check port 8080
client = server2.available();
if(client) {
  // do port 8080 page
}

..... two different clients, client and client2 thus:

// check port 80
EthernetClient client = server.available();
if(client) {
  // do port 80 page
}

// check port 8080
client2 = server2.available();  // <<<<<<<<<<, client2
if(client) {                                     //<<<<<<<<<<< client2
  // do port 8080 page
}

Even if I could do that, it seems from your snippets that it's not necessary.

edit.... except I'd have gone EthernetClient client2 = server.available();

Further EDIT.... but Thanks, it works with the code you supplied. Now my problem is to try to find another port that I can forward. Right now I'm seeing the second page from the lan side. At your or zk's suggestion a while back I tried to forward ports up in the 808x range, when it wasn't letting me use 80, eventually finding that 8085 was permitted. Tried 8086 for second server and it doesn't work. I guess this is a matter of trial and error....

So here's an idea for a useless machine (UM)....

1x E'net shield running 2 servers and 2 clients, talking to each other completely "invisibly", with each client like in the playground example that queries google, talking to one of the servers and getting a 200 OK back.

This is an even more useless UM than I've seen before because with UMs you usually see something, like it switching itself off. This one would just be just sending stuff round the 'net and you wouldn't even know it was on in the first place.

If anybody's interested, my two servers from one shield are available here and here.

I have decided that my next E'net project will be to construct a virtual coffee server, compliant with HTCPCP/1.0 as contemplated in RFC2324

But meantime, having got 2x servers going, I want to get a Server and a Client going simultaneously.

Before I get too involved... I'm going to look at combining the WebServer and WebClient sketches as a start, is there anything I need to consider? Any "gotchas"?

JimboZA:
But meantime, having got 2x servers going, I want to get a Server and a Client going simultaneously.

Before I get too involved... I'm going to look at combining the WebServer and WebClient sketches as a start, is there anything I need to consider? Any "gotchas"?

Not really. I use a web server and email client together. The only problem that could arise would be too many server clients waiting for the server, and there is no socket available for the client connection. I try to service all the server clients (if possible) before attempting to connect to a server with the client section.

Thanks ST, I'll give it a whirl.