RAII helper class that manages a socket and closes it automatically when it goes out of scope.
Synopsis
Declared in <util/sock.h>
class Sock;
Types
Name |
Description |
Equality comparator for |
|
Auxiliary requested/occurred events to wait for in |
|
Hasher for a |
Type Aliases
Name |
Description |
Bitmask type for the I/O readiness events passed to and returned from |
|
On which socket to wait for what events in |
Member Functions
Name |
Description |
|
Constructors |
|
Destructor, close the socket or do nothing if empty. |
Assignment operators |
|
|
accept(2) wrapper. Equivalent to |
|
bind(2) wrapper. Equivalent to |
|
connect(2) wrapper. Equivalent to |
|
getsockname(2) wrapper. Equivalent to |
|
getsockopt(2) wrapper. Equivalent to |
|
Check if still connected. |
|
Check if the underlying socket can be used for |
|
listen(2) wrapper. Equivalent to |
|
recv(2) wrapper. Equivalent to |
|
Read from socket until a terminator character is encountered. Will never consume bytes past the terminator from the socket. |
|
send(2) wrapper. Equivalent to |
|
|
|
Set the non‐blocking option on the socket. |
|
setsockopt(2) wrapper. Equivalent to |
|
Wait for readiness for input (recv) or output (send). |
|
Same as |
Check if the internal socket is equal to |
Static Data Members
Name |
Description |
Ignored if passed to |
|
If passed to |
|
If passed to |
Protected Data Members
Name |
Description |
Contained socket. |
Non-Member Functions
Name |
Description |
Create a socket and try to connect to the specified service, using the provided timeout. |
|
Create a socket and try to connect to the specified service. |
|
Connect to a specified destination service through a SOCKS5 proxy by first connecting to the SOCKS5 proxy. |
|
Create a real socket from the operating system. |
|
Get the bind address for a socket as CService. |
Created with MrDocs