for EthernetInterface library compatibility.\\ ** Unoffical fix. may be a problem. **

Dependents:   SNIC-httpclient-example SNIC-ntpclient-example

Fork of SNICInterface by muRata

Files at this revision

API Documentation at this revision

Comitter:
ban4jp
Date:
Fri Nov 21 03:50:48 2014 +0000
Parent:
43:d80bbb12ffe6
Child:
45:bed083d9f739
Commit message:
Fixed: HTTPClient library compatibility.

Changed in this revision

Socket/TCPSocketConnection.cpp Show annotated file Show diff for this revision Revisions of this file
Socket/TCPSocketConnection.h Show annotated file Show diff for this revision Revisions of this file
--- a/Socket/TCPSocketConnection.cpp	Fri Nov 14 00:52:31 2014 +0000
+++ b/Socket/TCPSocketConnection.cpp	Fri Nov 21 03:50:48 2014 +0000
@@ -191,7 +191,7 @@
 
     // SNIC_SEND_FROM_SOCKET_REQ
     FUNC_OUT();
-    return 0;
+    return length;
 }
 
 int TCPSocketConnection::send_all(char *data_p, int length)
@@ -229,9 +229,17 @@
         return -1;
     }
     con_info_p->is_receive_complete = true;
-    while( con_info_p->is_received == false )
+    if( con_info_p->is_received == false )
     {
+        // Try receive
         Thread::yield();
+        
+        if( con_info_p->is_received == false )
+        {
+            // No data received.
+            FUNC_OUT();
+            return 0;
+        }
     }
     // Get packet data from buffer for receive.
     for (i = 0; i < length; i ++) 
@@ -253,6 +261,11 @@
     return i;
 }
 
+int TCPSocketConnection::receive_all(char* data_p, int length)
+{
+    return receive( data_p, length );
+}
+
 void TCPSocketConnection::setAcceptSocket( int socket_id )
 {
     FUNC_IN();
--- a/Socket/TCPSocketConnection.h	Fri Nov 14 00:52:31 2014 +0000
+++ b/Socket/TCPSocketConnection.h	Fri Nov 21 03:50:48 2014 +0000
@@ -69,6 +69,13 @@
         @return the number of received bytes on success (>=0) or -1 on failure
      */
     int receive(char *data_p, int length);
+
+    /** Send data to the remote host.
+        @param data The buffer to send to the host.
+        @param length The length of the buffer to send.
+        @return the number of written bytes on success (>=0) or -1 on failure
+     */
+    int receive_all(char *data_p, int length);
     
     void setAcceptSocket( int socket_id );
 private: