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

Public Member Functions

 UdpServerSocket (size_t bufferSize)
 
int GetErrNo () const
 
bool Create (SOCKET_AF_t af)
 
bool IsValid () const
 
bool Bind (unsigned port)
 
bool SetMulticastTTL (int multicastTTL)
 
bool SetMulticastMembership (const char *group, bool join)
 
size_t AwaitIncoming (timeval timeout)
 
size_t AwaitIncoming ()
 
std::string GetRemoteAddrInfo () const
 
size_t ReadData (void *buf, size_t n)
 
net_socket_t GetHandle () const
 

Private Member Functions

 UdpServerSocket (const UdpServerSocket &)
 
UdpServerSocketoperator= (const UdpServerSocket &)
 

Private Attributes

SocketAddressm_addr
 
SocketAddressm_from
 
net_socket_t m_socket
 
int m_errno
 
char * m_buffer
 
char * m_bufptr
 
size_t m_buflen
 
size_t m_rcvlen
 
struct timeval m_timeout
 

Detailed Description

Definition at line 315 of file socket.h.

Member Function Documentation

◆ AwaitIncoming()

size_t UdpServerSocket::AwaitIncoming ( timeval  timeout)

Wait for incoming data.

Returns
the size of datagram else 0 when timeout occurred

Definition at line 1118 of file socket.cpp.

◆ Bind()

bool UdpServerSocket::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 989 of file socket.cpp.

◆ Create()

bool UdpServerSocket::Create ( SOCKET_AF_t  af)

Initialize the socket for the given protocol.

Returns
true on success, else false

Definition at line 960 of file socket.cpp.

◆ GetErrNo()

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

Definition at line 325 of file socket.h.

◆ GetHandle()

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

Definition at line 385 of file socket.h.

◆ GetRemoteAddrInfo()

std::string UdpServerSocket::GetRemoteAddrInfo ( ) const
Returns
the address string of the remote host that provided the incoming datagram

Definition at line 1171 of file socket.cpp.

◆ IsValid()

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

Definition at line 984 of file socket.cpp.

◆ ReadData()

size_t UdpServerSocket::ReadData ( void *  buf,
size_t  n 
)

Read remaining data from the datagram buffer.

Parameters
bufthe pointer to write received data
nthe number of byte to read
Returns
the number of received byte

Definition at line 1179 of file socket.cpp.

◆ SetMulticastMembership()

bool UdpServerSocket::SetMulticastMembership ( const char *  group,
bool  join 
)

Configure socket to join/leave the given multicast group.

Parameters
groupaddress name of the group
joinadd/drop membership
Returns
true on success, else false

Definition at line 1066 of file socket.cpp.

◆ SetMulticastTTL()

bool UdpServerSocket::SetMulticastTTL ( int  multicastTTL)

Configure hop limit value to be used for multicast packets on the opened socket.

Parameters
multicastTTL
Returns
true on success, else false

Definition at line 1027 of file socket.cpp.


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