Reference.ServerWrite History

Hide minor edits - Show changes to output

September 02, 2013, at 04:00 PM by Federico -
Changed lines 7-8 from:
Write data to all the clients connected to a server.
to:
Write data to all the clients connected to a server. This data is sent as a byte or series of bytes.
September 02, 2013, at 03:39 PM by Federico -
Changed lines 11-12 from:
''server''.write(data)
to:
''server''.write(val) \\
''server''.write(buf, len)
Changed lines 16-17 from:
'''data''': the value to write (byte or char)
to:
'''val''': a value to send as a single byte (byte or char)

'''buf''': an array to send as a series of bytes (byte or char)

'''len''': the length of the buffer

Changed line 67 from:
(:sourceend:)
to:
(:sourceend:)
November 09, 2011, at 09:30 PM by Scott Fitzgerald -
Changed lines 40-41 from:
EthernetServer server = Server(23);
to:
EthernetServer server = EthernetServer(23);
November 09, 2011, at 09:29 PM by Scott Fitzgerald -
Changed line 54 from:
Client client = server.available();
to:
EthernetClient client = server.available();
November 09, 2011, at 09:23 PM by Scott Fitzgerald -
Added line 25:
#include <SPI.h>
Changed lines 40-41 from:
Server server = Server(23);
to:
EthernetServer server = Server(23);
October 31, 2011, at 02:35 PM by Tom Igoe -
Changed line 24 from:
[@
to:
(:source lang=arduino tabwidth=4:)
Changed line 60 from:
@]
to:
(:sourceend:)
October 31, 2011, at 01:54 AM by Scott Fitzgerald -
Changed lines 19-20 from:
None
to:
byte\\
write() returns the number of bytes written. It is not necessary to read this.
July 31, 2010, at 07:45 PM by Tom Igoe -
Changed lines 15-16 from:
data: the value to write (byte or char)
to:
'''data''': the value to write (byte or char)
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:
Added line 51:
// if an incoming client connects, there will be bytes available to read:
Changed lines 53-55 from:
if (client) {
to:
if (client == true) {
// read bytes from the incoming client and write them back
// to any clients connected to the server:
Deleted line 59:
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:31 PM by David A. Mellis -
Changed lines 11-12 from:
server.write(data)
to:
''server''.write(data)
September 02, 2008, at 10:30 PM by David A. Mellis -
Added lines 1-52:
''Server'' class

!!write()

!!!!Description

Write data to all the clients connected to a server.

!!!!Syntax

server.write(data)

!!!!Parameters

data: the value to write (byte or char)

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