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:
- 48:078adbe279ac
- Parent:
- 47:4c29c8f0cff2
- Child:
- 49:cd391662f254
--- a/SW_HTTPServer.cpp Sun Feb 05 18:52:21 2017 +0000 +++ b/SW_HTTPServer.cpp Sat Apr 08 19:39:51 2017 +0000 @@ -120,7 +120,8 @@ int _maxdynamicpages, PC * _pc, int _allocforheader, - int _allocforfile) + int _allocforfile, + int blockingtime) { webroot = (char *)malloc(strlen(_webroot)+1); strcpy(webroot, _webroot); @@ -150,8 +151,8 @@ server = new TCPSocketServer(); server->bind(port); server->listen(); - server->set_blocking(false, 1000); - client.set_blocking(false, 1000); //@TODO client is separate from server. any way to combine? + server->set_blocking(false, 10); + client.set_blocking(false, 10); //@TODO client is separate from server. any way to combine? ResetPerformanceData(); PerformanceTimer.start(); } @@ -238,6 +239,8 @@ op = ReceivingHeader; t_ref = RecordPerformanceData(&perfData.ConnectionAccepted, t_ref); INFO("Accepted at %u", (unsigned int)PerformanceTimer.read_us()); + } else { + INFO("Timeout waiting for accept()"); } break; @@ -319,6 +322,9 @@ bytes = strlen(msg); INFO("Sending %d bytes", bytes); //INFO("send:\r\n%s", msg); + #ifdef DEBUG + int r = + #endif client.send((char *)msg, bytes); INFO("client.send returned: %d", r); }