SNIC UART Interface library: Serial to Wi-Fi library for Murata TypeYD Wi-Fi module. For more information about TypeYD: http://www.murata.co.jp/products/microwave/module/lbwb1zzydz/index.html

Dependents:   SNIC-xively-jumpstart-demo SNIC-FluentLogger-example TCPEchoServer murataDemo ... more

Fork of YDwifiInterface by Takao Kishino

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Tue Mar 31 02:48:32 2015 +0000
Parent:
47:69dd5911fc6a
Child:
49:3376556ba6ad
Commit message:
Fixed: HTTPClient library compatibility. https://developer.mbed.org/users/ban4jp/code/SNICInterface_PullReq/rev/c50e7332afcc

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	Mon Feb 02 00:10:06 2015 +0000
+++ b/Socket/TCPSocketConnection.cpp	Tue Mar 31 02:48:32 2015 +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	Mon Feb 02 00:10:06 2015 +0000
+++ b/Socket/TCPSocketConnection.h	Tue Mar 31 02:48:32 2015 +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: