Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months ago.
Problems whit HTTPServer poll()
Hi,
I'm tryng to perform a programable data register and want to use the HTTPServer to use html and javascript to make the configuration and programming pages and RPCFunction to manage the sensors. I wrote an test program based in Henry Leinen's Example and at first time works including the RPCFunction request, but I start to notice that after 4 request the system stop to answer, the led that indicate the sistem is alive keep blinking but the requests after the number 4 are "ignored". I discard any incompatibility with the RPCFunction and always are the same number of request (4), I tryed to use svr.poll(false) to use the no blocking mode but don't function.
In using an LPC4088 and the mbed online compiler.
I'll appreciate any help.
The test code is this:
- include "mbed.h"
- include "HTTPServer.h"
- include "FsHandler.h"
- include "LocalFileSystem.h"
- include "RpcHandler.h"
- include "mbed_rpc.h" #include "RPCFunction.h"
- include "SDFileSystem.h"
- define IP_ADDRD "192.168.0.200" IP por defecto
- define IP_MSKD "255.255.255.0" Máscara por defecto
- define IP_GWD "192.168.0.1" GW por defecto Use LED1 to indicate that the main loop is still executing DigitalOut myled(LED1); DigitalOut led2(LED2); Use the serial connection 'pc' to dump debug information Serial pc(USBTX, USBRX, "pc"); Instantiate a HTTPServer to handle incoming requests HTTPServer svr; Instantiate a local file system handler named 'local' which will be used later to access files on the mbed. LocalFileSystem local("local");
SDFileSystem sd(p5, p6, p7, p8, "sd"); MOSI, MISO, SCLK, SSEL
FILE *fp;
Create the EthernetInterface. This is optional, please see the documentation of HTTP Server's start method. EthernetInterface eth;
void mifuncion(Arguments * input, Reply * output); RPCFunction mifun(&mifuncion,"mifuncion");
int main() { led2=0; RPC::add_rpc_class<RpcDigitalOut>(); HTTPFsRequestHandler::mount("/sd/", "/"); svr.addHandler<HTTPFsRequestHandler>("/"); svr.addHandler<HTTPRpcRequestHandler>("/RPC");
Initialize the EthernetInterface and initiate a connection using DHCP. eth.init(IP_ADDRD,IP_MSKD,IP_GWD); eth.connect(); svr.start(80, ð); while(true){ svr.poll(); wait(1); myled=0; wait(1); myled=1; } }
void mifuncion(Arguments * input, Reply * output){ led2=!led2;
}
Question relating to:
![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)