Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Socket by
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;
