Alternative TCPSocket example using an HTTP GET to read a short "helloworld" text web page using a different server
Fork of ARMs demo HTTP socket demo. ARM's server was redirected and the demo was no longer working. An alternative server was setup and the code was modified to display the web page text in addition to just "200 OK". Only works for a very short web page - buffer only 400 characters but RAM is running out on the LPC1768 in the demo! Data read from the web page is read and parsed to control the mbed's 4 LEDs for a basic IoT demo.
Diff: main.cpp
- Revision:
- 4:d3627ca18f87
- Parent:
- 3:576f312d2601
- Child:
- 5:66c4a71d22e9
--- a/main.cpp Thu Feb 04 20:17:42 2021 +0000 +++ b/main.cpp Thu Feb 04 20:39:35 2021 +0000 @@ -23,7 +23,7 @@ char sbuffer[] = "GET /hello.txt HTTP/1.1\r\nHost: hamblen.ece.gatech.edu\r\n\r\n"; int scount = socket.send(sbuffer, sizeof sbuffer); //print out packet - printf("sent %d [%.*s]\n", scount, strstr(sbuffer, "\r\n")-sbuffer, sbuffer); + printf("sent %d [%.*s]\n\r", scount, strstr(sbuffer, "\r\n")-sbuffer, sbuffer); // Recieve a simple http response and print out the response line and text char rbuffer[400]; //enough for a very short text page - almost out of RAM!