CPPMyth
Library to interoperate with MythTV server
Loading...
Searching...
No Matches
NSROOT::TcpServerSocket Class Reference
Collaboration diagram for NSROOT::TcpServerSocket:

Public Types

enum  AcceptStatus { ACCEPT_ERROR = -1 , ACCEPT_TIMEOUT = 0 , ACCEPT_SUCCESS = 1 , ACCEPT_FAILURE = 2 }

Public Member Functions

int GetErrNo () const
bool Create (SOCKET_AF_t af)
bool IsValid () const
bool Bind (unsigned port)
bool ListenConnection (int queueSize=SOCKET_LISTEN_QUEUE_SIZE)
AcceptStatus AcceptConnection (TcpSocket &socket, int timeout)
std::string GetRemoteAddrInfo ()
void Close ()
net_socket_t GetHandle () const

Private Member Functions

 TcpServerSocket (const TcpServerSocket &)
TcpServerSocket & operator= (const TcpServerSocket &)

Private Attributes

SocketAddressm_addr
net_socket_t m_socket
int m_errno
unsigned m_requestQueueSize

Detailed Description

Definition at line 173 of file socket.h.

Member Enumeration Documentation

◆ AcceptStatus

enum NSROOT::TcpServerSocket::AcceptStatus

Definition at line 209 of file socket.h.

Constructor & Destructor Documentation

◆ TcpServerSocket()

TcpServerSocket::TcpServerSocket ( )

Definition at line 607 of file socket.cpp.

◆ ~TcpServerSocket()

TcpServerSocket::~TcpServerSocket ( )
virtual

Definition at line 615 of file socket.cpp.

Member Function Documentation

◆ AcceptConnection()

TcpServerSocket::AcceptStatus TcpServerSocket::AcceptConnection ( TcpSocket & socket,
int timeout )

Await a connection.

Parameters
socketthe tcp socket to connect on new request
timeoutin seconds
Returns
AcceptStatus

Definition at line 721 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 670 of file socket.cpp.

References IsValid().

◆ Close()

void TcpServerSocket::Close ( )

Close the socket.

Definition at line 792 of file socket.cpp.

References IsValid().

◆ Create()

bool TcpServerSocket::Create ( SOCKET_AF_t af)

Initialize the socket for the given protocol.

Returns
true on success, else false

Definition at line 625 of file socket.cpp.

References IsValid().

◆ GetErrNo()

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

Definition at line 182 of file socket.h.

◆ GetHandle()

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

Definition at line 237 of file socket.h.

◆ GetRemoteAddrInfo()

std::string TcpServerSocket::GetRemoteAddrInfo ( )
Returns
the address string of the accepted remote

Definition at line 784 of file socket.cpp.

◆ IsValid()

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

Definition at line 665 of file socket.cpp.

Referenced by Bind(), Close(), Create(), and ListenConnection().

Here is the caller graph for this function:

◆ ListenConnection()

bool TcpServerSocket::ListenConnection ( int queueSize = SOCKET_LISTEN_QUEUE_SIZE)

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 706 of file socket.cpp.

References IsValid().

Field Documentation

◆ m_addr

SocketAddress* NSROOT::TcpServerSocket::m_addr
private

Definition at line 240 of file socket.h.

◆ m_errno

int NSROOT::TcpServerSocket::m_errno
private

Definition at line 242 of file socket.h.

◆ m_requestQueueSize

unsigned NSROOT::TcpServerSocket::m_requestQueueSize
private

Definition at line 243 of file socket.h.

◆ m_socket

net_socket_t NSROOT::TcpServerSocket::m_socket
private

Definition at line 241 of file socket.h.


The documentation for this class was generated from the following files:
  • /home/jlb/src/janbar/PVR/cppmythlib/cppmyth/src/private/socket.h
  • /home/jlb/src/janbar/PVR/cppmythlib/cppmyth/src/private/socket.cpp