Sese Framework
2.3.0
A cross-platform framework
|
Reusable socket builder for address and port. More...
#include <ReusableSocket.h>
Public Member Functions | |
ReusableSocket (IPAddress::Ptr address, Socket::Type type=Socket::Type::TCP) | |
socket_t | makeRawSocket () noexcept |
std::optional< Socket > | makeSocket () noexcept |
Protected Member Functions | |
std::optional< Socket > | builtinMakeSocket () noexcept |
Protected Attributes | |
IPAddress::Ptr | addr {} |
Socket::Type | type {} |
Reusable socket builder for address and port.
Linux: The kernel handles load balancing, and multiple sockets can receive connections
Darwin: No load balancing, only the last socket can receive connections
Windows: No load balancing, only the first socket can receive connections
|
explicit |
Initialize the reusable socket template for address and port
address | The address |
type | The type |
|
protectednoexcept |
References addr, sese::net::Address::getRawAddress(), sese::net::Socket::IPv4, sese::net::Socket::IPv6, and type.
Referenced by makeRawSocket(), and makeSocket().
|
noexcept |
Build a native socket according to the template
-1 | Creation failed |
References builtinMakeSocket().
Referenced by sese::service::SystemBalanceLoader::init().
|
noexcept |
Build a sese::net::Socket according to the template
nullptr | Creation failed |
References builtinMakeSocket().
|
protected |
Referenced by builtinMakeSocket().
|
protected |
Referenced by builtinMakeSocket().