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 8:6db0cbf4761a, committed 2016-06-16
- Comitter:
- bulmecisco
- Date:
- Thu Jun 16 16:51:46 2016 +0000
- Parent:
- 7:a5ead1402704
- Commit message:
- M3 Board Socket Communication
Changed in this revision
--- a/EthernetInterface.lib Mon May 04 22:47:02 2015 +0000 +++ b/EthernetInterface.lib Thu Jun 16 16:51:46 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/EthernetInterface/#2fc406e2553f +https://developer.mbed.org/users/bulmecisco/code/EthernetInterface/#f42b26560a20
--- a/main.cpp Mon May 04 22:47:02 2015 +0000
+++ b/main.cpp Thu Jun 16 16:51:46 2016 +0000
@@ -1,7 +1,10 @@
#include "mbed.h"
#include "EthernetInterface.h"
+#include "string.h"
-#define ECHO_SERVER_PORT 7
+DigitalOut led1(LED1);
+
+#define ECHO_SERVER_PORT 9050
int main (void) {
EthernetInterface eth;
@@ -17,7 +20,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, 1500); // Timeout after (1.5)s
printf("Connection from: %s\n", client.get_address());
char buffer[256];
@@ -29,16 +32,21 @@
buffer[n] = '\0';
printf("Received message from Client :'%s'\n",buffer);
+ if(strstr(buffer, "On1"))
+ led1 = 1;
+ if(strstr(buffer, "Off1"))
+ led1 = 0;
+
// reverse the message
- char temp;
+ /*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);
+ printf("Sending message to Client: '%s'\n","OK");
// Echo received message back to client
client.send_all(buffer, n);
--- a/mbed-rtos.lib Mon May 04 22:47:02 2015 +0000 +++ b/mbed-rtos.lib Thu Jun 16 16:51:46 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#557d5b275f31 +http://mbed.org/users/mbed_official/code/mbed-rtos/#4c105b8d7cae
