CPPMyth
Library to interoperate with MythTV server
NSROOT::TcpServerSocket Class Reference
Collaboration diagram for NSROOT::TcpServerSocket:

Public Member Functions

int GetErrNo () const
 
bool Create (SOCKET_AF_t af)
 
bool IsValid () const
 
bool Bind (unsigned port)
 
bool ListenConnection (int queueSize=SOCKET_CONNECTION_REQUESTS)
 
bool AcceptConnection (TcpSocket &socket)
 
void Close ()
 
net_socket_t GetHandle () const
 

Private Member Functions

 TcpServerSocket (const TcpServerSocket &)
 
TcpServerSocketoperator= (const TcpServerSocket &)
 

Private Attributes

SocketAddressm_addr
 
net_socket_t m_socket
 
int m_errno
 
unsigned m_requestQueueSize
 

Detailed Description

Definition at line 160 of file socket.h.

Member Function Documentation

◆ AcceptConnection()

bool TcpServerSocket::AcceptConnection ( TcpSocket socket)

Await a connection.

Parameters
socketthe tcp socket to connect on new request
Returns
true on success, else false

Definition at line 604 of file socket.cpp.

References NSROOT::TcpSocket::IsValid(), and NSROOT::TcpSocket::SetReadAttempt().

◆ Bind()

bool TcpServerSocket::Bind ( unsigned  port)

Bind the socket to the given port on any local addresses.

Parameters
port
Returns
true on success, else false

Definition at line 553 of file socket.cpp.

◆ Close()

void TcpServerSocket::Close ( )

Close the socket.

Definition at line 624 of file socket.cpp.

◆ Create()

bool TcpServerSocket::Create ( SOCKET_AF_t  af)

Initialize the socket for the given protocol.

Returns
true on success, else false

Definition at line 509 of file socket.cpp.

◆ GetErrNo()

int NSROOT::TcpServerSocket::GetErrNo ( ) const
inline
Returns
the last error occuring on call

Definition at line 169 of file socket.h.

◆ GetHandle()

net_socket_t NSROOT::TcpServerSocket::GetHandle ( ) const
inline
Returns
the socket handle

Definition at line 211 of file socket.h.

◆ IsValid()

bool TcpServerSocket::IsValid ( ) const
Returns
true when socket is created, else false

Definition at line 548 of file socket.cpp.

◆ ListenConnection()

bool TcpServerSocket::ListenConnection ( int  queueSize = SOCKET_CONNECTION_REQUESTS)

Prepare to accept connections on the socket.

Parameters
queueSizethe maximum length for the queue of pending connections
Returns
true on success, else false

Definition at line 589 of file socket.cpp.


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