45 #ifndef __sockpp_acceptor_h 46 #define __sockpp_acceptor_h 128 base::operator=(std::move(rhs));
149 bool open(
const sock_address& addr,
int queSize=DFLT_QUE_SIZE,
bool reuseSock=
true);
170 template <
typename STREAM_SOCK,
typename ADDR=
typename STREAM_SOCK::addr_t>
229 base::operator=(std::move(rhs));
251 return base::open(addr, queSize);
278 #endif // __sockpp_acceptor_h acceptor_tmpl(acceptor_tmpl &&acc)
Move constructor.
Definition: acceptor.h:213
static acceptor create(int domain)
Creates an unbound acceptor socket with an open OS socket handle.
Generic socket address.
Definition: sock_address.h:64
sock_address_any address() const
Gets the local address to which the socket is bound.
stream_socket accept(sock_address *clientAddr=nullptr)
Accepts an incoming TCP connection and gets the address of the client.
static socket_t create_handle(int domain)
Creates an underlying acceptor socket.
Definition: acceptor.h:84
static const int DFLT_QUE_SIZE
The default listener queue size.
Definition: acceptor.h:74
Base class for streaming sockets, such as TCP and Unix Domain.
Definition: stream_socket.h:62
acceptor & operator=(acceptor &&rhs)
Move assignment.
Definition: acceptor.h:127
addr_t address() const
Gets the local address to which we are bound.
Definition: acceptor.h:236
static socket_t create_handle(int domain)
Creates a streaming socket.
Definition: stream_socket.h:75
bool open(in_port_t port, int queSize=DFLT_QUE_SIZE)
Opens the acceptor socket, binds the socket to all adapters and starts it listening.
Definition: acceptor.h:260
bool bind(const addr_t &addr)
Binds the socket to the specified address.
Definition: acceptor.h:242
bool bind(const sock_address &addr)
Binds the socket to the specified address.
acceptor(acceptor &&acc)
Move constructor.
Definition: acceptor.h:113
bool check_ret_bool(T ret) const
Checks the value and if less than zero, sets last error.
Definition: socket.h:149
ADDR addr_t
The type of address for the acceptor and streams.
Definition: acceptor.h:184
bool open(const addr_t &addr, int queSize=DFLT_QUE_SIZE)
Opens the acceptor socket, binds it to the specified address, and starts listening.
Definition: acceptor.h:250
acceptor(socket_t handle)
Creates an acceptor from an existing OS socket handle and claims ownership of the handle...
Definition: acceptor.h:98
acceptor(const sock_address &addr, int queSize=DFLT_QUE_SIZE)
Creates an acceptor socket and starts it listening to the specified address.
Definition: acceptor.h:105
acceptor_tmpl & operator=(acceptor_tmpl &&rhs)
Move assignment.
Definition: acceptor.h:228
Class for creating a streaming server.
Definition: acceptor.h:63
socket()
Creates an unconnected (invalid) socket.
Definition: socket.h:183
bool open(const sock_address &addr, int queSize=DFLT_QUE_SIZE, bool reuseSock=true)
Opens the acceptor socket, binds it to the specified address, and starts listening.
acceptor()
Creates an unconnected acceptor.
Definition: acceptor.h:92
Definition: acceptor.h:51
Base template class for streaming servers of specific address families.
Definition: acceptor.h:171
static socket create(int domain, int type, int protocol=0)
Creates a socket with the specified communications characterics.
acceptor_tmpl(in_port_t port, int queSize=DFLT_QUE_SIZE)
Creates a acceptor and starts it listening on the specified port.
Definition: acceptor.h:205
stream_sock_t accept(addr_t *clientAddr=nullptr)
Accepts an incoming connection and gets the address of the client.
Definition: acceptor.h:269
Base class for socket objects.
Definition: socket.h:84
int socket_t
The OS socket handle.
Definition: socket.h:60
Class for a TCP/IP socket address.
acceptor_tmpl()
Creates an unconnected acceptor.
Definition: acceptor.h:189
acceptor_tmpl(const addr_t &addr, int queSize=DFLT_QUE_SIZE)
Creates a acceptor and starts it listening on the specified address.
Definition: acceptor.h:195
bool listen(int queSize=DFLT_QUE_SIZE)
Sets the socket listening on the address to which it is bound.
Definition: acceptor.h:136
socket_t handle() const
Get the underlying OS socket handle.
Definition: socket.h:259
STREAM_SOCK stream_sock_t
The type of streaming socket from the acceptor.
Definition: acceptor.h:182
Classes for stream sockets.
static acceptor_tmpl create()
Creates an unbound acceptor socket with an open OS socket handle.
Definition: acceptor.h:220