for pet feeder system & add timer function

Fork of httpServer by justin kim

Files at this revision

API Documentation at this revision

Comitter:
hjjeon
Date:
Tue Jun 30 00:21:41 2015 +0000
Parent:
0:e59cc54df17c
Child:
2:dd293a10a772
Commit message:
Change timeout value and set non blocking

Changed in this revision

HTTPConnection.cpp Show annotated file Show diff for this revision Revisions of this file
HTTPServer.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/HTTPConnection.cpp	Mon Jun 29 09:03:40 2015 +0000
+++ b/HTTPConnection.cpp	Tue Jun 30 00:21:41 2015 +0000
@@ -109,7 +109,7 @@
         return -1;
     
     szLine[0] = 0;
-    m_Tcp.set_blocking(false);
+    m_Tcp.set_blocking(false, 1500);
     
     if (!m_Tcp.is_connected()) {
         error("NOT COnnected anymore");
@@ -125,11 +125,11 @@
         //  Check that - if no character was currently received - the timeout period is reached.
         if ((c == 0) || (c==-1)) {
             //  no character was read, so check if operation timed out
-            if (tm.read_ms() > nTimeout) {
+            //if (tm.read_ms() > nTimeout) {
                 //  Operation timed out
-                INFO("Timeout occured in function 'receiveLine'.");
+                //INFO("Timeout occured in function 'receiveLine'.");
                 return -1;
-            }
+            //}
         }
         
         //  Check if line terminating character was received
--- a/HTTPServer.cpp	Mon Jun 29 09:03:40 2015 +0000
+++ b/HTTPServer.cpp	Tue Jun 30 00:21:41 2015 +0000
@@ -26,7 +26,7 @@
 void HTTPServer::StdErrorHandler(HTTPConnection::HTTPMessage& msg, TCPSocketConnection& tcp)
 {
     char echoHeader[256];
-    tcp.set_blocking(true, 1500);
+    tcp.set_blocking(false, 1500);
     sprintf(echoHeader,"HTTP/1.0 404 Fail\r\nConnection: close\r\nContent-Length: %d\r\nContent-Type: text/html\r\nServer: mbed embedded\r\n\n\r",strlen(szStdErrorPage));
     tcp.send(echoHeader, strlen(echoHeader));
     tcp.send((char*)szStdErrorPage, strlen(szStdErrorPage));
@@ -61,8 +61,8 @@
 
     INFO("Connected !");
     //  set into non blocking operation
-    m_Svr.set_blocking(false, 100);
-
+    m_Svr.set_blocking(false, 1500); 
+    
     return true;
 }