Low-level OS socket handle. More...
#include <SocketDescriptor.h>
Public Member Functions | |
Result | create (SocketFlags::AddressFamily addressFamily, SocketFlags::SocketType socketType=SocketFlags::SocketStream, SocketFlags::ProtocolType protocol=SocketFlags::ProtocolTcp, SocketFlags::BlockingType blocking=SocketFlags::Blocking, SocketFlags::InheritableType inheritable=SocketFlags::NonInheritable) |
Creates a new SocketDescriptor Descriptor of given family, type, protocol. | |
Result | isInheritable (bool &value) const |
Check if socket is inheritable by child processes. | |
Result | setInheritable (bool value) |
Changes the inheritable flag for this socket. | |
Result | setBlocking (bool value) |
Changes the blocking flag for this socket (if IO reads / writes should be blocking or not) | |
Result | getAddressFamily (SocketFlags::AddressFamily &addressFamily) const |
Get address family (IPV4 / IPV6) of this socket. | |
Low-level OS socket handle.
It also allow querying inheritability and changing it (and blocking mode)
Example (extracted from unit test):
|
nodiscard |
Creates a new SocketDescriptor Descriptor of given family, type, protocol.
addressFamily | Address family (IPV4 / IPV6) |
socketType | SocketDescriptor type (Stream or Dgram) |
protocol | Protocol (TCP or UDP) |
blocking | If the socket should be created in blocking mode |
inheritable | If the socket should be inheritable by child processes |
|
nodiscard |
|
nodiscard |
Check if socket is inheritable by child processes.
[out] | value | if set to true indicates that this socket is inheritable by child processes |
|
nodiscard |
Changes the blocking flag for this socket (if IO reads / writes should be blocking or not)
value | true if this socket should be made blocking, false for non-blocking |
|
nodiscard |
Changes the inheritable flag for this socket.
value | true if this socket should be made inheritable, false for non-inheritable |