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:
Sat Nov 22 15:32:42 2014 +0000
Parent:
45:bed083d9f739
Commit message:
Fixed: NTPClient library compatibility.

Changed in this revision

Socket/Socket.h Show annotated file Show diff for this revision Revisions of this file
Socket/UDPSocket.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r bed083d9f739 -r e1cb45f7a27f Socket/Socket.h
--- a/Socket/Socket.h	Sat Nov 22 11:01:16 2014 +0000
+++ b/Socket/Socket.h	Sat Nov 22 15:32:42 2014 +0000
@@ -24,6 +24,11 @@
 #include "SNIC_Core.h"
 #include "SNIC_UartMsgUtil.h"
 
+#define htons(x) __REV16(x)
+#define ntohs(x) __REV16(x)
+#define htonl(x) __REV(x)
+#define ntohl(x) __REV(x)
+
 typedef unsigned long socklen_t;
 
 /** Socket file descriptor and select wrapper
diff -r bed083d9f739 -r e1cb45f7a27f Socket/UDPSocket.cpp
--- a/Socket/UDPSocket.cpp	Sat Nov 22 11:01:16 2014 +0000
+++ b/Socket/UDPSocket.cpp	Sat Nov 22 15:32:42 2014 +0000
@@ -303,9 +303,17 @@
     con_info_p->mutex.lock();
     con_info_p->is_receive_complete = true;
     con_info_p->mutex.unlock();
-    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.
     int i;