A simple web server that can be bound to either the EthernetInterface or the WiflyInterface.
Dependents: Smart-WiFly-WebServer WattEye X10Svr SSDP_Server
Diff: SW_HTTPServer.cpp
- Revision:
- 16:6ebacf2946d8
- Parent:
- 14:19c5f6151319
- Child:
- 17:69ff00ce39f4
--- a/SW_HTTPServer.cpp Tue Aug 13 11:07:36 2013 +0000 +++ b/SW_HTTPServer.cpp Sun Sep 01 19:19:08 2013 +0000 @@ -105,9 +105,7 @@ server = new TCPSocketServer(); server->bind(port); server->listen(); -// server->set_blocking(false, 0); -// client.set_blocking(false, 0); -// server->accept(client); + server->set_blocking(false, 10); ResetPerformanceData(); PerformanceTimer.start(); } @@ -165,7 +163,7 @@ static state op = Idle; static char * bPtr = headerbuffer; int n; - static int t_ref; // reference point for the PerformanceTimer + static unsigned int t_ref; // reference point for the PerformanceTimer #ifdef DEBUG static state lastOp = Reset; @@ -185,9 +183,9 @@ bPtr = headerbuffer; if (0 == server->accept(client)) { op = Receiving; - t_ref = PerformanceTimer.read_us(); + t_ref = (unsigned int)PerformanceTimer.read_us(); #ifdef DEBUG - pc->printf("Accept at %d\r\n", t_ref); + pc->printf("Accept at %u\r\n", t_ref); #endif } break; @@ -723,9 +721,9 @@ } -int HTTPServer::RecordPerformanceData(SW_PerformanceParam * param, int refTime) +unsigned int HTTPServer::RecordPerformanceData(SW_PerformanceParam * param, unsigned int refTime) { - int t_now = PerformanceTimer.read_us(); + unsigned int t_now = (unsigned int)PerformanceTimer.read_us(); param->TotalTime_us += (t_now - refTime); param->Samples++; if ((t_now - refTime) > param->MaxTime_us)