xdrpp
RFC4506 XDR compiler and message library
|
Self-closing socket. More...
#include <socket.h>
Public Member Functions | |
unique_sock (sock_t s) | |
unique_sock (unique_sock &&uf) | |
unique_sock & | operator= (unique_sock &&uf) |
sock_t | get () const |
Return the file descriptor number, but maintain ownership. | |
operator bool () const | |
True if the file descriptor is not -1. | |
sock_t | release () |
Return the file descriptor number, relinquishing ownership of it. More... | |
void | clear () |
void | reset (sock_t s) |
Self-closing socket.
Note that this socket will be closed as soon as it goes out of scope, hence it is important to see whether functions you pass it to take a "unique_sock &" or a "const unique_sock &&". In the latter case, you are expected to keep the file descriptor around.
|
inline |
Return the file descriptor number, relinquishing ownership of it.
The unique_sock
will have file descriptor -1 after this method returns.