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: EthernetInterface mbed-rtos mbed
Fork of TCPEchoServer by
Revision 6:30f62685b255, committed 2014-05-16
- Comitter:
- avnisha
- Date:
- Fri May 16 19:34:28 2014 +0000
- Parent:
- 5:0f0fdadab553
- Commit message:
- timeout 100 secs
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0f0fdadab553 -r 30f62685b255 main.cpp
--- a/main.cpp Fri Mar 01 15:37:15 2013 +0000
+++ b/main.cpp Fri May 16 19:34:28 2014 +0000
@@ -1,5 +1,6 @@
#include "mbed.h"
#include "EthernetInterface.h"
+#include <cctype>
#define ECHO_SERVER_PORT 7
@@ -17,7 +18,7 @@
printf("\nWait for new connection...\n");
TCPSocketConnection client;
server.accept(client);
- client.set_blocking(false, 1500); // Timeout after (1.5)s
+ client.set_blocking(false, 100000); // NB Timeout
printf("Connection from: %s\n", client.get_address());
char buffer[256];
@@ -25,6 +26,11 @@
int n = client.receive(buffer, sizeof(buffer));
if (n <= 0) break;
+ char *p = buffer;
+ while (*p) {
+ *p = toupper(*p);
+ p++;
+ }
client.send_all(buffer, n);
if (n <= 0) break;
}
