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.
Diff: Socket.h
- Revision:
- 10:d24738f4ef99
- Parent:
- 8:9cf9c2d45264
- Child:
- 11:3d83c348fb8b
--- a/Socket.h Fri Jul 27 15:56:20 2012 +0000
+++ b/Socket.h Tue Jul 31 11:50:55 2012 +0000
@@ -40,6 +40,13 @@
*/
Socket();
+ /** Set blocking or non-blocking mode of the socket and a timeout on
+ blocking socket operations
+ \param blocking true for blocking mode, false for non-blocking mode.
+ \param timeout timeout in ms.
+ */
+ void set_blocking(bool blocking, unsigned int timeout=1500);
+
/** Close the socket file descriptor
*/
int close();
@@ -50,7 +57,10 @@
int wait_readable(TimeInterval& timeout);
int wait_writable(TimeInterval& timeout);
-
+
+ bool _blocking;
+ unsigned int _timeout;
+
private:
int select(struct timeval *timeout, bool read, bool write);
};
@@ -64,7 +74,7 @@
/** Time Interval
\param ms time interval expressed in milliseconds
*/
- TimeInterval(int ms);
+ TimeInterval(unsigned int ms);
private:
struct timeval _time;
mbed official


