Reference.ServerBegin History

Hide minor edits - Show changes to output

November 09, 2011, at 09:31 PM by Scott Fitzgerald -
Changed lines 37-38 from:
EthernetServer server = Server(23);
to:
EthernetServer server = EthernetServer(23);
Changed line 51 from:
Client client = server.available();
to:
EthernetClient client = server.available();
November 09, 2011, at 09:21 PM by Scott Fitzgerald -
Added line 24:
#include <SPI.h>
Changed lines 37-38 from:
Server server = Server(23);
to:
EthernetServer server = Server(23);
November 01, 2011, at 03:37 PM by Scott Fitzgerald -
Changed line 23 from:
[@
to:
(:source lang=arduino:)
Changed line 57 from:
@]
to:
(:sourceend:)
July 31, 2010, at 07:42 PM by Tom Igoe -
Changed lines 26-28 from:
// network configuration. gateway and subnet are optional.
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 32:
// the subnet:
Added line 49:
// if an incoming client connects, there will be bytes available to read:
Changed lines 51-53 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-2 from:
''Server'' class
to:
[[Ethernet]] : ''Server'' class
September 02, 2008, at 10:27 PM by David A. Mellis -
Changed lines 11-12 from:
server.begin()
to:
''server''.begin()
September 02, 2008, at 10:26 PM by David A. Mellis -
Added lines 1-51:
''Server'' class

!!begin()

!!!!Description

Tells the server to begin listening for incoming connections.

!!!!Syntax

server.begin()

!!!!Parameters

None

!!!!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