
TCP client mbed RTOS
Dependencies: mbed LM75B mbed-rtos EthernetInterface
Revision 9:4757a976148d, committed 2012-07-27
- Comitter:
- emilmont
- Date:
- Fri Jul 27 13:59:39 2012 +0000
- Parent:
- 8:2570d35b0c47
- Child:
- 10:8aeafea0e859
- Commit message:
- Cleanup example
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 |
--- a/EthernetInterface.lib Thu Jul 26 15:12:00 2012 +0000 +++ b/EthernetInterface.lib Fri Jul 27 13:59:39 2012 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/EthernetInterface/#b7a3766f6253 +http://mbed.org/users/mbed_official/code/EthernetInterface/#9dce8f443bfd
--- a/main.cpp Thu Jul 26 15:12:00 2012 +0000 +++ b/main.cpp Fri Jul 27 13:59:39 2012 +0000 @@ -10,24 +10,22 @@ TCPSocketConnection sock; sock.connect("mbed.org", 80); - char http_cmd[] = "GET /media/uploads/donatien/hello.txt HTTP/1.1\r\nHost: %s\r\n\r\n"; - sock.send_all(http_cmd, sizeof(http_cmd) - 1, 3000); + char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n"; + sock.send_all(http_cmd, sizeof(http_cmd)); - char in_buf[256]; + char buffer[300]; int ret; while (true) { - ret = sock.receive(in_buf, 255, 100); + ret = sock.receive(buffer, sizeof(buffer)-1); if (ret <= 0) break; - - in_buf[ret] = '\0'; - printf("Received %d chars from server: %s\n", ret, in_buf); + buffer[ret] = '\0'; + printf("Received %d chars from server:\n%s\n", ret, buffer); } sock.close(); eth.disconnect(); - while(1) { - } + while(1) {} }