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.
Diff: main.cpp
- Revision:
- 0:55680e5cc478
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon May 30 12:11:59 2011 +0000
@@ -0,0 +1,56 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HTTPClient.h"
+
+EthernetNetIf eth; //(IpAddr(160,48,199,80),IpAddr(255,255,255,128),IpAddr(0,0,0,0),IpAddr(0,0,0,0));
+
+HTTPClient http;
+HTTPText txt;
+
+void HTTPGetCallbackEvent(HTTPResult result) {
+
+ int iRetValue = http.getHTTPResponseCode();
+
+ printf("HTTPGetCallbackEvent->Result: %d \r\n", iRetValue);
+
+ if (result==HTTP_OK) {
+// printf("Result :\"%s\"\r\n", txt.gets());
+ printf("Result ok : %s\n", txt.gets());
+ //printf("Result :ok\r\n");
+ } else {
+ printf("Error %d\r\n", result);
+ }
+}
+
+
+
+int main() {
+
+ printf("Setting up...\r\n");
+ EthernetErr ethErr = eth.setup();
+ if (ethErr) {
+ printf("Error %d in setup.\r\n", ethErr);
+ return -1;
+ }
+ printf("Setup OK\r\n");
+
+
+
+
+// http.setRequestHeader("Connection", "Keep-Alive");
+
+ printf("Send message\r\n");
+
+
+ HTTPResult r = http.get("http://mbed.org/media/uploads/donatien/hello.txt", &txt, HTTPGetCallbackEvent);
+// HTTPResult r = http.get("http://160.48.199.50/r?b=1&r=0&s=1", &txt, HTTPGetCallbackEvent);
+
+ while (1) {
+ //printf("alive\r\n");
+ Net::poll();
+ }
+
+ return 0;
+
+}
+