1 // This is a demo of the RBBB running as webserver with the Ether Card
6 // ethernet interface mac address, must be unique on the LAN
7 static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
8 static byte myip[] = { 192,168,0,100 };
10 byte Ethernet::buffer[500];
14 if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
15 Serial.println( "Failed to access Ethernet controller");
16 ether.staticSetup(myip);
19 static word homePage() {
20 bfill = ether.tcpOffset();
23 "Content-Type: text/html\r\n"
24 "Pragma: no-cache\r\n"
26 "<meta http-equiv='refresh' content='1'/>"
27 "<title>RBBB server</title>"
28 "<h1>Hello World 2</h1>"));
29 return bfill.position();
33 word len = ether.packetReceive();
34 word pos = ether.packetLoop(len);
36 if (pos) // check if valid tcp data is received
37 ether.httpServerReply(homePage()); // send web page data