mbed socket API

Dependents:   EthernetInterface EthernetInterface_RSF EthernetInterface EthernetInterface ... more

Deprecated

This is an mbed 2 sockets library. For mbed 5, network sockets have been revised to better support additional network stacks and thread safety here.

Revision:
6:cd2e5559786d
Parent:
5:300e7ad2dc1d
Child:
10:d24738f4ef99
--- a/UDPSocket.cpp	Thu Jul 26 15:07:32 2012 +0000
+++ b/UDPSocket.cpp	Fri Jul 27 13:58:53 2012 +0000
@@ -50,13 +50,13 @@
 }
 
 // -1 if unsuccessful, else number of bytes written
-int UDPSocket::sendTo(UDPPacket& packet, int timeout) {
+int UDPSocket::sendTo(UDPPacket& packet, int timeout_ms) {
     if (_sock_fd < 0)
         return -1;
     
-    if (timeout != 0) {
-        set_timeout(timeout);
-        if (wait_writable() != 0)
+    if (timeout_ms != 0) {
+        TimeInterval timeout(timeout_ms);
+        if (wait_writable(timeout) != 0)
             return -1;
     }
     
@@ -64,13 +64,13 @@
 }
 
 // -1 if unsuccessful, else number of bytes received
-int UDPSocket::receiveFrom(UDPPacket& packet, int timeout) {
+int UDPSocket::receiveFrom(UDPPacket& packet, int timeout_ms) {
     if (_sock_fd < 0)
         return -1;
     
-    if (timeout != 0) {
-        set_timeout(timeout);
-        if (wait_readable() != 0)
+    if (timeout_ms != 0) {
+        TimeInterval timeout(timeout_ms);
+        if (wait_readable(timeout) != 0)
             return -1;
     }