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.
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 00004 int main() { 00005 EthernetInterface eth; 00006 eth.init(); //Use DHCP 00007 eth.connect(); 00008 printf("IP Address is %s\n", eth.getIPAddress()); 00009 00010 TCPSocketConnection sock; 00011 sock.connect("mbed.org", 80); 00012 00013 char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n"; 00014 sock.send_all(http 00015 _cmd, sizeof(http_cmd)-1); 00016 00017 char buffer[300]; 00018 int ret; 00019 while (true) { 00020 ret = sock.receive(buffer, sizeof(buffer)-1); 00021 if (ret <= 0) 00022 break; 00023 buffer[ret] = '\0'; 00024 printf("Received %d chars from server:\n%s\n", ret, buffer); 00025 } 00026 00027 sock.close(); 00028 00029 eth.disconnect(); 00030 00031 while(1) {} 00032 } 00033
Generated on Tue Jul 26 2022 18:26:35 by
1.7.2