xdrpp
RFC4506 XDR compiler and message library
Public Member Functions | List of all members
xdr::unique_sock Class Reference

Self-closing socket. More...

#include <socket.h>

Public Member Functions

 unique_sock (sock_t s)
 
 unique_sock (unique_sock &&uf)
 
unique_sockoperator= (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)
 

Detailed Description

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.

Definition at line 124 of file socket.h.

Member Function Documentation

◆ release()

sock_t xdr::unique_sock::release ( )
inline

Return the file descriptor number, relinquishing ownership of it.

The unique_sock will have file descriptor -1 after this method returns.

Definition at line 144 of file socket.h.


The documentation for this class was generated from the following file: