Serial Proxy Webserver
The mbed will be able to connect via ethernet to e.g. the internet as a server or client. But as we don't have an ethernet stack yet, i thought for some testing it'd be interesting to just push the http requests to the board over serial so we can do some experiments.
The idea is to run a proxy on the host PC which listens for connections, then pipes the data over serial to the mbed.
Experiment 1
Used an app called Serproxy to setup the bridge:
- Windows files at SerialProxyWebserver - you need both the .exe and .cfg files. Save them somewhere e.g. your desktop. You will need to modify the config file to point at the com port your mbed uses (or what may be more reliable is to change the mbed com port to point at one of of com1-5 (Device manager > ports (com & lpt) > right-click the mbed com port > properties > port settings > advanced...). mine was setup as COM2
Code up a simple webserver on mbed:
#include "mbed.h"
Serial pc(USBTX, USBRX);
DigitalOut led(LED1);
int main() {
char request[64];
pc.scanf("%[^\n]\n", request); // read until new line
led = 1;
pc.printf("<html><body><h1>Hello World!</h1>The request you sent was <pre>%s</pre></body></html>", request);
}
Problems
- There seems no obvious way of making the serial proxy close from the mbed, which leaves the client hanging. So I set the timeout to 1 second, so it closes the connection and i just assume the transaction will have completed in that time.
run the .exe, then having reset the mbed go to http://localhost:5332/ (or whatever port is appropriate) with FF, and after a second you should get a response. You'll need to reset the mbed each time to get a response :)

