ucc::ListenSocket Class Reference

A bound socket used to listen for inbound socket connections. More...

#include <socket.h>

Inheritance diagram for ucc::ListenSocket:

Inheritance graph
[legend]
Collaboration diagram for ucc::ListenSocket:

Collaboration graph
[legend]

Public Member Functions

 ListenSocket (char *address, char *service, unsigned backlog=5, int protocol=0)
 Create and bind a listener socket.
socket_t accept (struct sockaddr_storage *address=((void *) 0))
 Accept a socket connection.
bool waitConnection (timeout_t timeout=Timer::inf)
 Wait for a pending connection.
 operator socket_t ()
 Get the socket descriptor of the listener.
socket_t operator* ()
 Get the socket descriptor of the listener by pointer reference.

Detailed Description

A bound socket used to listen for inbound socket connections.

This class is commonly used for TCP and DCCP listener sockets.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 1503 of file socket.h.


Constructor & Destructor Documentation

ucc::ListenSocket::ListenSocket ( char *  address,
char *  service,
unsigned  backlog = 5,
int  protocol = 0 
)

Create and bind a listener socket.

Parameters:
address to bind on or "*" for all.
service port to bind listener.
backlog size for buffering pending connections.
protocol for socket if not TCPIP.


Member Function Documentation

socket_t ucc::ListenSocket::accept ( struct sockaddr_storage *  address = ((void *) 0)  ) 

Accept a socket connection.

Parameters:
address to save peer connecting.
Returns:
socket descriptor of connected socket.

ucc::ListenSocket::operator socket_t (  )  [inline]

Get the socket descriptor of the listener.

Returns:
socket descriptor.

Reimplemented from ucc::Socket.

Definition at line 1534 of file socket.h.

socket_t ucc::ListenSocket::operator* (  )  [inline]

Get the socket descriptor of the listener by pointer reference.

Returns:
socket descriptor.

Reimplemented from ucc::Socket.

Definition at line 1541 of file socket.h.

bool ucc::ListenSocket::waitConnection ( timeout_t  timeout = Timer::inf  )  [inline]

Wait for a pending connection.

Parameters:
timeout to wait.
Returns:
true when acceptable connection is pending.

Definition at line 1527 of file socket.h.


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

Generated on Tue Jul 28 21:43:34 2009 for UCommon by  doxygen 1.5.9