Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem WIZnetInterface httpServer mbed
Fork of HTTPWebServer-WIZwiki-W7500 by
Diff: main.cpp
- Revision:
- 7:a5ead1402704
- Parent:
- 3:36fd3cfad85a
- Child:
- 8:f837e0d255e8
diff -r 5dae237341f7 -r a5ead1402704 main.cpp
--- a/main.cpp Tue Jun 04 16:07:06 2013 +0100
+++ b/main.cpp Mon May 04 22:47:02 2015 +0000
@@ -7,7 +7,7 @@
EthernetInterface eth;
eth.init(); //Use DHCP
eth.connect();
- printf("IP Address is %s\n", eth.getIPAddress());
+ printf("\nServer IP Address is %s\n", eth.getIPAddress());
TCPSocketServer server;
server.bind(ECHO_SERVER_PORT);
@@ -25,6 +25,22 @@
int n = client.receive(buffer, sizeof(buffer));
if (n <= 0) break;
+ // print received message to terminal
+ buffer[n] = '\0';
+ printf("Received message from Client :'%s'\n",buffer);
+
+ // reverse the message
+ char temp;
+ for(int f = 0, l = n-1; f<l; f++,l--){
+ temp = buffer[f];
+ buffer[f] = buffer[l];
+ buffer[l] = temp;
+ }
+
+ // print reversed message to terminal
+ printf("Sending message to Client: '%s'\n",buffer);
+
+ // Echo received message back to client
client.send_all(buffer, n);
if (n <= 0) break;
}
