class socket :
This class mainly defines internal stuff to be used by derived classes.
The only public features that it defines, and which is therefore common to all the socket classes, is the blocking state. All sockets can be set as blocking or non-blocking.
In blocking mode, socket functions will hang until the operation completes, which means that the entire program (well, in fact the current thread if you use multiple ones) will be stuck waiting for your socket operation to complete.
In non-blocking mode, all the socket functions will return immediately. If the socket is not ready to complete the requested operation, the function simply returns the proper status code (NotReady).
The default mode, which is blocking, is the one that is generally
used, in combination with threads or selectors. The non-blocking
mode is rather used in real-time applications that run an endless
loop that can poll the socket often enough, and cannot afford
blocking this loop.
method destroy :
method is_blocking :
method set_blocking :
bool -> unit
In blocking mode, calls will not return until they have
completed their task. For example, a call to receive in blocking
mode won't return until some data was actually received. In
non-blocking mode, calls will always return immediately, using
the return code to signal whether there was data available or
not. By default, all sockets are blocking.