2

Dependencies:   EthernetInterface2 mbed-rtos mbed-src2

Files at this revision

API Documentation at this revision

Comitter:
zain_mbed
Date:
Mon Jun 13 09:19:37 2016 +0000
Commit message:
5

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed-src.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 2aa2e4bfb5ff EthernetInterface.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Mon Jun 13 09:19:37 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/zain_mbed/code/EthernetInterface2/#fbfa1a37637e
diff -r 000000000000 -r 2aa2e4bfb5ff main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 13 09:19:37 2016 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+ DigitalOut green(LED_GREEN);
+DigitalOut red(LED_RED);
+DigitalOut blue(LED_BLUE);
+#define ECHO_SERVER_PORT   8089
+const char* ECHO_SERVER_ADDRESS = "192.168.68.250 ";
+
+ 
+int main (void) {
+    EthernetInterface eth;
+    green=1;
+   red=1;
+   blue=1;
+       eth.init("192.168.68.93","255.255.255.0","192.168.68.1");
+    eth.connect();
+    printf("\nServer IP Address is %s\n", eth.getIPAddress());
+    green=1;
+   red=0;
+   blue=1;
+    UDPSocket server;
+    server.bind(ECHO_SERVER_PORT);
+    
+    Endpoint client;
+        Endpoint echo_server;
+
+        echo_server.set_address(ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT);
+
+    while (true) {
+            char buffer[1000];
+  green=1;
+   red=0;
+   blue=1;
+        printf("\nWaiting for UDP packet...\n");
+        int n = server.receiveFrom(client, buffer, sizeof(buffer));
+        buffer[n] = '\0';
+   green=0;
+   red=1;
+   blue=1;
+        printf("Received packet from: %s\n", client.get_address());
+        printf("Packet contents : '%s'\n",buffer);
+        printf("Sending Packet back to Client\n");
+        server.sendTo(echo_server, buffer, n);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 2aa2e4bfb5ff mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Mon Jun 13 09:19:37 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#3d9d2b8b8f17
diff -r 000000000000 -r 2aa2e4bfb5ff mbed-src.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-src.lib	Mon Jun 13 09:19:37 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/zain_mbed/code/mbed-src/#fa05c01d56bc