blocxx
Public Member Functions | Private Attributes | List of all members
BLOCXX_NAMESPACE::ServerSocket Class Reference

#include <ServerSocket.hpp>

Inheritance diagram for BLOCXX_NAMESPACE::ServerSocket:
BLOCXX_NAMESPACE::SelectableIFC BLOCXX_NAMESPACE::IntrusiveCountableBase

Public Member Functions

 ServerSocket (SSLServerCtxRef sslCtx)
 Allocate a new Inet Server Socket. More...
 
 ServerSocket (SocketFlags::ESSLFlag isSSL=SocketFlags::E_NOT_SSL)
 Allocate a new Inet Server Socket. More...
 
 ServerSocket (const ServerSocket &arg)
 Copy ctor. More...
 
Socket accept (int timeoutSecs=-1) BLOCXX_DEPRECATED
 Accept a connection to the server socket. More...
 
Socket accept (const Timeout &timeout)
 Accept a connection to the server socket. More...
 
void doListen (UInt16 port, SocketFlags::ESSLFlag isSSL, int queueSize=10, const String &listenAddr=SocketAddress::ALL_LOCAL_ADDRESSES, SocketFlags::EReuseAddrFlag reuseAddr=SocketFlags::E_REUSE_ADDR)
 Start listening on a port. More...
 
void doListen (UInt16 port, int queueSize=10, const String &listenAddr=SocketAddress::ALL_LOCAL_ADDRESSES, SocketFlags::EReuseAddrFlag reuseAddr=SocketFlags::E_REUSE_ADDR)
 Start listening on a port. More...
 
void doListen (const String &filename, int queueSize=10, bool reuseAddr=true)
 Start listening on a Unix Domain Socket. More...
 
void close ()
 Close the listen socket. More...
 
SocketAddress getLocalAddress ()
 Return the address of the local host. More...
 
SocketHandle_t getfd () const
 Get the file descriptor of the listen socket. More...
 
Select_t getSelectObj () const
 
- Public Member Functions inherited from BLOCXX_NAMESPACE::SelectableIFC
virtual ~SelectableIFC ()
 

Private Attributes

IntrusiveReference< ServerSocketImplm_impl
 

Additional Inherited Members

- Protected Member Functions inherited from BLOCXX_NAMESPACE::IntrusiveCountableBase
 IntrusiveCountableBase ()
 
 IntrusiveCountableBase (const IntrusiveCountableBase &)
 
IntrusiveCountableBaseoperator= (const IntrusiveCountableBase &)
 
virtual ~IntrusiveCountableBase ()
 

Detailed Description

Definition at line 82 of file ServerSocket.hpp.

Constructor & Destructor Documentation

◆ ServerSocket() [1/3]

BLOCXX_NAMESPACE::ServerSocket::ServerSocket ( SSLServerCtxRef  sslCtx)

Allocate a new Inet Server Socket.

Parameters
isSSLis the Server Socket an SSL socket?

Definition at line 75 of file ServerSocket.cpp.

◆ ServerSocket() [2/3]

BLOCXX_NAMESPACE::ServerSocket::ServerSocket ( SocketFlags::ESSLFlag  isSSL = SocketFlags::E_NOT_SSL)

Allocate a new Inet Server Socket.

Parameters
isSSLis the Server Socket an SSL socket?

Definition at line 81 of file ServerSocket.cpp.

◆ ServerSocket() [3/3]

BLOCXX_NAMESPACE::ServerSocket::ServerSocket ( const ServerSocket arg)

Copy ctor.

Definition at line 87 of file ServerSocket.cpp.

References m_impl.

Member Function Documentation

◆ accept() [1/2]

Socket BLOCXX_NAMESPACE::ServerSocket::accept ( const Timeout timeout)

Accept a connection to the server socket.

Parameters
timeoutSecsthe timeout
Returns
an Socket for the connection just accepted.

Definition at line 101 of file ServerSocket.cpp.

References m_impl.

◆ accept() [2/2]

Socket BLOCXX_NAMESPACE::ServerSocket::accept ( int  timeoutSecs = -1)

Accept a connection to the server socket.

Parameters
timeoutSecsthe timeout
Returns
an Socket for the connection just accepted.

Definition at line 95 of file ServerSocket.cpp.

◆ close()

void BLOCXX_NAMESPACE::ServerSocket::close ( )

Close the listen socket.

Exceptions
SocketException

Definition at line 129 of file ServerSocket.cpp.

◆ doListen() [1/3]

void BLOCXX_NAMESPACE::ServerSocket::doListen ( const String filename,
int  queueSize = 10,
bool  reuseAddr = true 
)

Start listening on a Unix Domain Socket.

Parameters
filenameThe filename for the unix domain socket
queueSizethe size of the listen queue
Exceptions
SocketException

Definition at line 122 of file ServerSocket.cpp.

◆ doListen() [2/3]

void BLOCXX_NAMESPACE::ServerSocket::doListen ( UInt16  port,
int  queueSize = 10,
const String listenAddr = SocketAddress::ALL_LOCAL_ADDRESSES,
SocketFlags::EReuseAddrFlag  reuseAddr = SocketFlags::E_REUSE_ADDR 
)

Start listening on a port.

Parameters
portThe port to listen on
queueSizethe size of the listen queue
allInterfacesdo we listen on all interfaces?
Exceptions
SocketException

Definition at line 114 of file ServerSocket.cpp.

◆ doListen() [3/3]

void BLOCXX_NAMESPACE::ServerSocket::doListen ( UInt16  port,
SocketFlags::ESSLFlag  isSSL,
int  queueSize = 10,
const String listenAddr = SocketAddress::ALL_LOCAL_ADDRESSES,
SocketFlags::EReuseAddrFlag  reuseAddr = SocketFlags::E_REUSE_ADDR 
)

Start listening on a port.

Parameters
portThe port to listen on
isSSLis the Server Socket an SSL socket?
queueSizethe size of the listen queue
allInterfacesdo we listen on all interfaces?
Exceptions
SocketException

Definition at line 107 of file ServerSocket.cpp.

References m_impl.

◆ getfd()

SocketHandle_t BLOCXX_NAMESPACE::ServerSocket::getfd ( ) const

Get the file descriptor of the listen socket.

Returns
a handle to the listen socket

Definition at line 141 of file ServerSocket.cpp.

◆ getLocalAddress()

SocketAddress BLOCXX_NAMESPACE::ServerSocket::getLocalAddress ( )

Return the address of the local host.

Returns
an SocketAddress representing the local node

Definition at line 135 of file ServerSocket.cpp.

◆ getSelectObj()

Select_t BLOCXX_NAMESPACE::ServerSocket::getSelectObj ( ) const
virtual

Implements BLOCXX_NAMESPACE::SelectableIFC.

Definition at line 147 of file ServerSocket.cpp.

Member Data Documentation

◆ m_impl

IntrusiveReference<ServerSocketImpl> BLOCXX_NAMESPACE::ServerSocket::m_impl
private

Definition at line 197 of file ServerSocket.hpp.

Referenced by accept(), doListen(), and ServerSocket().


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