1#ifndef NET_SocketHandle_h__
2#define NET_SocketHandle_h__
47 template<
class Socket>
62 : m_sockfd( other.release()) {}
66 : m_sockfd( other.sockfd) {}
68 operator SocketHandle_Ref<Socket>()
69 {
return SocketHandle_Ref<Socket>( release()); }
76 reset( other.release());
99 operator bool()
const {
return m_sockfd >= 0; }
103 explicit SocketHandle(
int sockfd) : m_sockfd(sockfd) {}
121 void reset(
int fd = -1)
135 template<
class Socket>
140 friend class SocketHandle<Socket>;
141 explicit SocketHandle_Ref(
int sockfd) : sockfd(sockfd) {}
#define TEMP_FAILURE_RETRY(expression)
A simple class to provide strict ownership of socket handles.
SocketHandle(SocketHandle &other)
copy constructor using move semantics
SocketHandle()
constructs an invalid socket handle
SocketHandle & operator=(SocketHandle &other)
assignment operator using move semantics