cc3000 hostdriver with the mbed socket interface

Dependents:   cc3000_hello_world_demo cc3000_simple_socket_demo cc3000_ntp_demo cc3000_ping_demo ... more

Files at this revision

API Documentation at this revision

Comitter:
Kojto
Date:
Sat Oct 05 20:29:39 2013 +0200
Parent:
27:5118ab0f6aa4
Child:
29:c40918cd9b6d
Commit message:
Commented select on UDP write (send), return in TCP receive

Changed in this revision

Socket/TCPSocketConnection.cpp 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
--- a/Socket/TCPSocketConnection.cpp	Fri Oct 04 07:06:29 2013 +0000
+++ b/Socket/TCPSocketConnection.cpp	Sat Oct 05 20:29:39 2013 +0200
@@ -112,7 +112,11 @@
     }
 
     int n = _cc3000_module->_socket.recv(_sock_fd, data, length, 0);
-    _is_connected = (n != 0);
+    if (n >= 0) {
+        _is_connected = 1;
+    } else {
+        _is_connected = 0;
+    }
 
     return n;
 }
--- a/Socket/UDPSocket.cpp	Fri Oct 04 07:06:29 2013 +0000
+++ b/Socket/UDPSocket.cpp	Sat Oct 05 20:29:39 2013 +0200
@@ -56,14 +56,14 @@
     if (_sock_fd < 0) {
         return -1;
     }
-
-    if (!_blocking) {
-        TimeInterval timeout(_timeout);
-        if (wait_writable(timeout) != 0) {
-            DBG_SOCKET("The socket is not writeable. _sock_fd: %d", _sock_fd);
-            return 0;
-        }
-    }
+    // TODO - seems to be a bug, waiting for TI to respond
+    // if (!_blocking) {
+    //     TimeInterval timeout(_timeout);
+    //     if (wait_writable(timeout) != 0) {
+    //         DBG_SOCKET("The socket is not writeable. _sock_fd: %d", _sock_fd);
+    //         return 0;
+    //     }
+    // }
 
     return _cc3000_module->_socket.sendto(_sock_fd, packet, length, 0, (sockaddr *)&remote._remote_host, sizeof(sockaddr));
 }