Reference.ServerConstructor History

Hide minor edits - Show changes to markup

November 01, 2011, at 04:38 PM by Scott Fitzgerald -
Changed lines 1-4 from:

Ethernet : EthernetServer class

EthernetServer()

to:

Ethernet : Server class

Server

Changed lines 7-59 from:
to:

Server is the base class for all Ethernet server based calls. It is not called directly, but invoked whenever you use a function that relies on it.

Functions

November 01, 2011, at 01:14 PM by Scott Fitzgerald -
Changed line 23 from:

[@

to:
Changed lines 59-60 from:

@]

to:
October 31, 2011, at 04:42 PM by Scott Fitzgerald -
Changed lines 1-4 from:

Ethernet : Server class

Server()

to:

Ethernet : EthernetServer class

EthernetServer()

Changed lines 38-39 from:

Server server = Server(23);

to:

EthernetServer server = EthernetServer(23);

July 31, 2010, at 07:42 PM by Tom Igoe -
July 31, 2010, at 07:41 PM by Tom Igoe -
Changed lines 15-16 from:

port: the port to listen on (int)

to:

port: the port to listen on (int)

July 31, 2010, at 07:36 PM by Tom Igoe -
July 31, 2010, at 07:35 PM by Tom Igoe -
Changed lines 27-28 from:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte ip[] = { 10, 0, 0, 177 };

to:
 // the media access control (ethernet hardware) address for the shield:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //the IP address for the shield: byte ip[] = { 10, 0, 0, 177 }; // the router's gateway address:

Added line 34:

// the subnet:

July 31, 2010, at 07:33 PM by Tom Igoe -
Added line 46:
  // if an incoming client connects, there will be bytes available to read:
Changed lines 48-50 from:
  if (client) {
to:
  if (client == true) {
    // read bytes from the incoming client and write them back
    // to any clients connected to the server:
September 02, 2008, at 10:35 PM by David A. Mellis -
Changed lines 1-4 from:

Ethernet

Server class

to:

Ethernet : Server class

September 02, 2008, at 10:34 PM by David A. Mellis -
Added lines 1-2:
September 02, 2008, at 10:24 PM by David A. Mellis -
September 02, 2008, at 10:23 PM by David A. Mellis -
Deleted lines 0-1:
September 02, 2008, at 10:23 PM by David A. Mellis -
Changed lines 1-2 from:

\\

to:
September 02, 2008, at 10:22 PM by David A. Mellis -
Changed line 1 from:
to:

\\

September 02, 2008, at 10:22 PM by David A. Mellis -
Added line 1:
September 02, 2008, at 10:22 PM by David A. Mellis -
Added lines 1-52:

Server class

Server()

Description

Create a server that listens for incoming connections on the specified port.

Syntax

Server(port);

Parameters

port: the port to listen on (int)

Returns

None

Example

#include <Ethernet.h>

// network configuration.  gateway and subnet are optional.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
byte gateway[] = { 10, 0, 0, 1 };
byte subnet[] = { 255, 255, 0, 0 };

// telnet defaults to port 23
Server server = Server(23);

void setup()
{
  // initialize the ethernet device
  Ethernet.begin(mac, ip, gateway, subnet);

  // start listening for clients
  server.begin();
}

void loop()
{
  Client client = server.available();
  if (client) {
    server.write(client.read());
  }
}

Share