9 years, 10 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:

  1. include "mbed.h"
  2. include "HTTPServer.h"
  3. include "FsHandler.h"
  4. include "LocalFileSystem.h"
  5. include "RpcHandler.h"
  6. include "mbed_rpc.h" #include "RPCFunction.h"
  7. include "SDFileSystem.h"
  1. define IP_ADDRD "192.168.0.200" IP por defecto
  2. define IP_MSKD "255.255.255.0" Máscara por defecto
  3. 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, &eth); while(true){ svr.poll(); wait(1); myled=0; wait(1); myled=1; } }

void mifuncion(Arguments * input, Reply * output){ led2=!led2;

}

Question relating to:

Working sample implementation for the EthernetInterface HTTPServer. ethernet, EthernetInterface, http, HTTPServer, server
Be the first to answer this question.