62 static constexpr unsigned short AnyPort{0};
191 bool m_isBlocking{
true};
void setBlocking(bool blocking)
Set the blocking state of the socket.
static constexpr unsigned short AnyPort
Some special values used by sockets.
Socket & operator=(const Socket &)=delete
Deleted copy assignment.
friend class SocketSelector
Socket(Socket &&socket) noexcept
Move constructor.
Status
Status codes that may be returned by socket functions.
@ Partial
The socket sent a part of the data.
@ Error
An unexpected error happened.
@ NotReady
The socket is not ready to send / receive data yet.
@ Disconnected
The TCP socket has been disconnected.
@ Done
The socket has sent / received the data.
Type
Types of protocols that the socket can use.
SocketHandle getNativeHandle() const
Return the internal handle of the socket.
void close()
Close the socket gracefully.
Socket & operator=(Socket &&socket) noexcept
Move assignment.
virtual ~Socket()
Destructor.
Socket(Type type)
Default constructor.
Socket(const Socket &)=delete
Deleted copy constructor.
void create()
Create the internal representation of the socket.
bool isBlocking() const
Tell whether the socket is in blocking or non-blocking mode.
void create(SocketHandle handle)
Create the internal representation of the socket from a socket handle.