Wizard
Software Engineering Project - Wizard
Loading...
Searching...
No Matches
sockpp::unix_acceptor Class Reference

#include <unix_acceptor.h>

Inheritance diagram for sockpp::unix_acceptor:
sockpp::acceptor sockpp::socket

Public Member Functions

 unix_acceptor ()
 
 unix_acceptor (const unix_address &addr, int queSize=DFLT_QUE_SIZE)
 
unix_address address () const
 
bool open (const unix_address &addr, int queSize=DFLT_QUE_SIZE)
 
unix_socket accept ()
 
bool open (const sock_address &addr, int queSize=DFLT_QUE_SIZE, bool reuseSock=true)
 
- Public Member Functions inherited from sockpp::acceptor
 acceptor ()
 
 acceptor (socket_t handle)
 
 acceptor (const sock_address &addr, int queSize=DFLT_QUE_SIZE)
 
 acceptor (acceptor &&acc)
 
acceptoroperator= (acceptor &&rhs)
 
bool listen (int queSize=DFLT_QUE_SIZE)
 
bool open (const sock_address &addr, int queSize=DFLT_QUE_SIZE, bool reuseSock=true)
 
stream_socket accept (sock_address *clientAddr=nullptr)
 
- Public Member Functions inherited from sockpp::socket
 socket ()
 
 socket (socket_t h)
 
 socket (socket &&sock) noexcept
 
virtual ~socket ()
 
bool is_open () const
 
bool operator! () const
 
 operator bool () const
 
socket_t handle () const
 
virtual sa_family_t family () const
 
socket clone () const
 
void clear (int val=0)
 
socket_t release ()
 
void reset (socket_t h=INVALID_SOCKET)
 
socketoperator= (socket &&sock) noexcept
 
bool bind (const sock_address &addr)
 
sock_address_any address () const
 
sock_address_any peer_address () const
 
bool get_option (int level, int optname, void *optval, socklen_t *optlen) const
 
template<typename T >
bool get_option (int level, int optname, T *val) const
 
bool set_option (int level, int optname, const void *optval, socklen_t optlen)
 
template<typename T >
bool set_option (int level, int optname, const T &val)
 
bool set_non_blocking (bool on=true)
 
int last_error () const
 
std::string last_error_str () const
 
bool shutdown (int how=SHUT_RDWR)
 
bool close ()
 

Additional Inherited Members

- Static Public Member Functions inherited from sockpp::acceptor
static acceptor create (int domain)
 
- Static Public Member Functions inherited from sockpp::socket
static void initialize ()
 
static void destroy ()
 
static socket create (int domain, int type, int protocol=0)
 
static std::tuple< socket, socketpair (int domain, int type, int protocol=0)
 
static std::string error_str (int errNum)
 
- Protected Member Functions inherited from sockpp::socket
bool close_on_err ()
 
void set_last_error ()
 
template<typename T >
check_ret (T ret) const
 
template<typename T >
bool check_ret_bool (T ret) const
 
socket_t check_socket (socket_t ret) const
 
bool check_socket_bool (socket_t ret) const
 
- Static Protected Member Functions inherited from sockpp::acceptor
static socket_t create_handle (int domain)
 
- Static Protected Member Functions inherited from sockpp::socket
static int get_last_error ()
 
- Static Protected Attributes inherited from sockpp::acceptor
static const int DFLT_QUE_SIZE = 4
 

Detailed Description

Class for creating a Unix-domain server. Objects of this class bind and listen on Unix-domain ports for connections. Normally, a server thread creates one of these and blocks on the call to accept incoming connections. The call to accept creates and returns a unix_stream_socket which can then be used for the actual communications.

Constructor & Destructor Documentation

◆ unix_acceptor() [1/2]

sockpp::unix_acceptor::unix_acceptor ( )
inline

Creates an unconnected acceptor.

◆ unix_acceptor() [2/2]

sockpp::unix_acceptor::unix_acceptor ( const unix_address & addr,
int queSize = DFLT_QUE_SIZE )
inline

Creates a acceptor and starts it listening on the specified address.

Parameters
addrThe TCP address on which to listen.
queSizeThe listener queue size.

Member Function Documentation

◆ accept()

unix_socket sockpp::unix_acceptor::accept ( )
inline

Accepts an incoming UNIX connection and gets the address of the client.

Returns
A unix_socket to the client.

◆ address()

unix_address sockpp::unix_acceptor::address ( ) const
inline

Gets the local address to which we are bound.

Returns
The local address to which we are bound.

◆ open() [1/2]

bool sockpp::acceptor::open ( const sock_address & addr,
int queSize = DFLT_QUE_SIZE,
bool reuseSock = true )

Base open call also work.

◆ open() [2/2]

bool sockpp::unix_acceptor::open ( const unix_address & addr,
int queSize = DFLT_QUE_SIZE )
inline

Opens the acceptor socket and binds it to the specified address.

Parameters
addrThe address to which this server should be bound.
queSizeThe listener queue size.
Returns
true on success, false on error

The documentation for this class was generated from the following file: