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: C12832 EthernetInterface mbed-rtos mbed
Fork of UDPEchoClient by
Revision 1:129986b437b1, committed 2012-07-26
- Comitter:
- emilmont
- Date:
- Thu Jul 26 16:35:11 2012 +0000
- Parent:
- 0:97e3476ef63e
- Child:
- 2:3307c4a7c499
- Commit message:
- First implementation
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Thu Jul 26 16:35:11 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/EthernetInterface/#b7a3766f6253
--- a/main.cpp Thu Jul 26 16:31:15 2012 +0000
+++ b/main.cpp Thu Jul 26 16:35:11 2012 +0000
@@ -1,1 +1,31 @@
#include "mbed.h"
+#include "EthernetInterface.h"
+
+const char* ECHO_SERVER_ADDRESS = "10.2.131.73";
+const int ECHO_PORT = 7;
+
+int main() {
+ EthernetInterface eth;
+ eth.init(); //Use DHCP
+ eth.connect();
+
+ UDPSocket sock;
+ sock.init();
+
+ char out_buffer[] = "Hello World\n";
+ UDPPacket out_packet(out_buffer, sizeof(out_buffer));
+ out_packet.set_address(ECHO_SERVER_ADDRESS, ECHO_PORT);
+ sock.sendTo(out_packet);
+
+ char in_buffer[256];
+ UDPPacket in_packet(in_buffer, sizeof(in_buffer));
+ int n = sock.receiveFrom(in_packet);
+
+ in_buffer[n] = '\0';
+ printf("%s\n", in_buffer);
+
+ sock.close();
+
+ eth.disconnect();
+ while(1) {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Thu Jul 26 16:35:11 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#4238c328365e
