Server vs. Ethernet Server / Port Number Assignment

  1. What is the difference between the "Server" class and the "Ethernet Server" class in the Ethernet library? If I just want to communicate with a Windows host computer, which one would I be better off using?

  2. What should I use as a port number? For a local connection to a PC, does this number matter? In my Windows application code, I just designate an IP address, a random port #12345, and a timout value in my client socket code, and I'm able to connect to 3rd party hardware servers.

As I stated in a previous post, I don't need web access or DCHP, as most of the example show. I can't find sample code that is as simple as connecting to a host PC as a basic server.

Thanks for your help.

The Server class in 0023 and earlier was renamed to EthernetServer in 1.0. There should not be Server.h and EthernetServer.h (Server.cpp and Ethernet.cpp) in any one library.

So, the question of which to use depends on which version of the IDE you are using.

  1. What should I use as a port number?

Generally, web server respond to port 80. Unless you have reason to use another port, such as port forwarding by domain on a router, use 80.

As I stated in a previous post, I don't need web access or DCHP, as most of the example show. I can't find sample code that is as simple as connecting to a host PC as a basic server.

It is not the job of a server to connect to anything. A server handles connection requests. I think your question needs clarification.

renniejohnson:
I don't need web access or DCHP, as most of the example show. I can't find sample code that is as simple as connecting to a host PC as a basic server.

The example here is pretty close to what you are asking for:

The IP address and port are hard coded. It accepts TCP connections and echos the bytes. No DHCP, no HTTP, just the barest bones.

Thanks Gardner. I'll review this code before I post again.