A simple HTTP server echoing received requests. Ethernet connection is over an ENC28J60 board. Usage: Type the server's IP address into you web browser and hit <ENTER>.

Dependencies:   UIPEthernet

Revision:
5:068f4c368ab0
Parent:
4:06fcbe983e24
Child:
6:c5eb31c60c8f
--- a/main.cpp	Fri Nov 27 21:15:45 2015 +0000
+++ b/main.cpp	Sat Nov 28 08:59:25 2015 +0000
@@ -16,17 +16,13 @@
 // Adapt the SPI pin names to your mbed platform/board if not present yet.
 #if defined(TARGET_LPC1768)
 UIPEthernetClass    UIPEthernet(p11, p12, p13, p8);         // mosi, miso, sck, cs
-#elif defined(TARGET_LPC1114)
-UIPEthernetClass    UIPEthernet(dp2, dp1, dp6, dp25);       // mosi, miso, sck, cs
-#elif defined(TARGET_LPC11U68)
-UIPEthernetClass    UIPEthernet(P0_9, P0_8, P1_29, P0_2);   // mosi, miso, sck, cs
-#elif defined(TARGET_NUCLEO_F103RB)
-UIPEthernetClass    UIPEthernet(D11, D12, D13, D10);        // mosi, miso, sck, cs
-#elif defined(TARGET_NUCLEO_F103RB)
-UIPEthernetClass    UIPEthernet(D11, D12, D13, D10);        // mosi, miso, sck, cs
-#elif defined(TARGET_NUCLEO_F401RE)
-UIPEthernetClass    UIPEthernet(D11, D12, D13, D10);        // mosi, miso, sck, cs
-#elif defined(TARGET_NUCLEO_F411RE)
+#elif defined(TARGET_NUCLEO_F103RB) || defined(TARGET_NUCLEO_L152RE) || defined(TARGET_NUCLEO_F030R8) || defined(TARGET_NUCLEO_F401RE) \
+   || defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_L053R8) || defined(TARGET_NUCLEO_F411RE) || defined(TARGET_NUCLEO_F334R8) \
+   || defined(TARGET_NUCLEO_F072RB) || defined(TARGET_NUCLEO_F091RC) || defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F070RB) \
+   || defined(TARGET_KL25Z ) || defined(TARGET_KL46Z) || defined(TARGET_K64F) || defined(TARGET_KL05Z) \
+   || defined(TARGET_K20D50M) || defined(TARGET_K22F) \
+   || defined(TARGET_NRF51822) \
+   || defined(TARGET_RZ_A1H)
 UIPEthernetClass    UIPEthernet(D11, D12, D13, D10);        // mosi, miso, sck, cs
 #endif
 
@@ -34,7 +30,9 @@
 const uint8_t       MY_MAC[6] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
 
 #if !defined(DHCP)
-// IP address must be unique and compatible with your network. Change as appropriate.
+// In case you'd like to use static IP address:
+// IP address must be unique and compatible with your network.
+// Change as appropriate.
 const IPAddress MY_IP(192, 168, 1, 181);
 #endif
 
@@ -47,21 +45,17 @@
  * @param
  * @retval
  */
-
 int main(void) {
 
 #if defined(DHCP)
-    pc.printf("Searching for DHCP server.\r\n");
-    pc.printf("Please wait..\r\n");
-
+    pc.printf("Searching for DHCP server..\r\n");
+ 
     if(UIPEthernet.begin(MY_MAC) != 1) {
         pc.printf("No DHCP server found.\r\n");
         pc.printf("Exiting application.\r\n");
         return 0;
     }
-
-    pc.printf("DHCP server found and configuration info received\r\n");
-
+    pc.printf("DHCP server found and configuration info received.\r\n");
     IPAddress   localIP = UIPEthernet.localIP();
     pc.printf("Local IP = ");
     for(uint8_t i = 0; i < 3; i++)
@@ -82,7 +76,7 @@
                 if(buf[0] == 'G' && buf[1] == 'E' && buf[2] == 'T') {
                     pc.printf("GET request received:\n\r");
                     pc.printf(buf);
-                    char    echoHeader[256] = { };
+                    char    echoHeader[256] = {};
                     sprintf
                     (
                         echoHeader,