CPPMyth
Library to interoperate with MythTV server
Loading...
Searching...
No Matches
NSROOT::UdpServerSocket Class Reference
Inheritance diagram for NSROOT::UdpServerSocket:
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 reuse=false)
bool Bind (const char *addr, unsigned port, bool reuse=false)
bool SetMulticastTTL (int multicastTTL)
bool SetMulticastMembership (const char *group, bool join)
size_t AwaitIncoming ()
std::string GetRemoteAddrInfo () const
bool SendData (const char *, size_t)
size_t ReceiveData (void *buf, size_t n)
size_t ReadData (void *buf, size_t n)
net_socket_t GetHandle () const
Public Member Functions inherited from NSROOT::NetSocket
void SetTimeout (timeval timeout)

Private Member Functions

 UdpServerSocket (const UdpServerSocket &)
UdpServerSocket & operator= (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

Additional Inherited Members

Protected Attributes inherited from NSROOT::NetSocket
struct timeval m_timeout

Detailed Description

Definition at line 341 of file socket.h.

Constructor & Destructor Documentation

◆ UdpServerSocket() [1/2]

UdpServerSocket::UdpServerSocket ( )

Definition at line 1075 of file socket.cpp.

◆ UdpServerSocket() [2/2]

UdpServerSocket::UdpServerSocket ( size_t bufferSize)

Definition at line 1090 of file socket.cpp.

◆ ~UdpServerSocket()

UdpServerSocket::~UdpServerSocket ( )

Definition at line 1104 of file socket.cpp.

Member Function Documentation

◆ AwaitIncoming()

size_t UdpServerSocket::AwaitIncoming ( )

Wait for incoming data.

Returns
the size of datagram else 0 when timeout occurred

Definition at line 1386 of file socket.cpp.

References IsValid().

Referenced by ReceiveData().

Here is the caller graph for this function:

◆ Bind() [1/2]

bool UdpServerSocket::Bind ( const char * addr,
unsigned port,
bool reuse = false )

Bind the socket to the given local address and port.

Parameters
addr
port
Returns
true on success, else false

Definition at line 1222 of file socket.cpp.

References IsValid().

◆ Bind() [2/2]

bool UdpServerSocket::Bind ( unsigned port,
bool reuse = false )

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

Parameters
port
Returns
true on success, else false

Definition at line 1157 of file socket.cpp.

References IsValid().

◆ Create()

bool UdpServerSocket::Create ( SOCKET_AF_t af)

Initialize the socket for the given protocol.

Returns
true on success, else false

Definition at line 1128 of file socket.cpp.

References IsValid().

◆ GetErrNo()

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

Definition at line 351 of file socket.h.

◆ GetHandle()

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

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

◆ IsValid()

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

Definition at line 1152 of file socket.cpp.

Referenced by AwaitIncoming(), Bind(), Bind(), Create(), ReadData(), ReceiveData(), SetMulticastMembership(), and SetMulticastTTL().

Here is the caller graph for this function:

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

References IsValid().

Referenced by ReceiveData().

Here is the caller graph for this function:

◆ ReceiveData()

size_t NSROOT::UdpServerSocket::ReceiveData ( void * buf,
size_t n )
inlinevirtual

Await incoming then read data from the datagram buffer.

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

Implements NSROOT::NetSocket.

Definition at line 419 of file socket.h.

References AwaitIncoming(), IsValid(), and ReadData().

◆ SendData()

bool NSROOT::UdpServerSocket::SendData ( const char * ,
size_t  )
inlinevirtual

A stub routine returns always false.

Returns
false

Implements NSROOT::NetSocket.

Definition at line 411 of file socket.h.

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

References IsValid().

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

References IsValid().

Field Documentation

◆ m_addr

SocketAddress* NSROOT::UdpServerSocket::m_addr
private

Definition at line 446 of file socket.h.

◆ m_buffer

char* NSROOT::UdpServerSocket::m_buffer
private

Definition at line 450 of file socket.h.

◆ m_buflen

size_t NSROOT::UdpServerSocket::m_buflen
private

Definition at line 452 of file socket.h.

◆ m_bufptr

char* NSROOT::UdpServerSocket::m_bufptr
private

Definition at line 451 of file socket.h.

◆ m_errno

int NSROOT::UdpServerSocket::m_errno
private

Definition at line 449 of file socket.h.

◆ m_from

SocketAddress* NSROOT::UdpServerSocket::m_from
private

Definition at line 447 of file socket.h.

◆ m_rcvlen

size_t NSROOT::UdpServerSocket::m_rcvlen
private

Definition at line 453 of file socket.h.

◆ m_socket

net_socket_t NSROOT::UdpServerSocket::m_socket
private

Definition at line 448 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