All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Radiant::TCPServerSocket Class Reference

A server TCP socket for accepting incoming connections. More...

#include <Radiant/TCPServerSocket.hpp>

Inheritance diagram for Radiant::TCPServerSocket:
Patterns::NotCopyable

Public Member Functions

TCPSocketaccept ()
 Accepts new connections. More...
 
bool close ()
 Closes the socket. More...
 
const QString host () const
 Returns the hostname. More...
 
bool isOpen () const
 Returns true of the socket is open. More...
 
bool isPendingConnection (unsigned int waitMicroSeconds=0)
 Check for pending connections Checks for pending connections and optionally blocks for the given timeout. More...
 
int open (const char *host, int port, int maxconnections=2)
 Opens a server TCP socket to desired host:port. More...
 
int port () const
 Returns the port number. More...
 
 TCPServerSocket ()
 Constructor.
 
 ~TCPServerSocket ()
 Destructor.
 

Detailed Description

A server TCP socket for accepting incoming connections.

Member Function Documentation

TCPSocket* Radiant::TCPServerSocket::accept ( )

Accepts new connections.

Blocks until a connection is received or the socket is closed.

Returns
connected socket or null in case of error
bool Radiant::TCPServerSocket::close ( )

Closes the socket.

Returns
True if the socket was succesfulle closed
const QString Radiant::TCPServerSocket::host ( ) const

Returns the hostname.

Returns
Hostname of the socket
bool Radiant::TCPServerSocket::isOpen ( ) const

Returns true of the socket is open.

Returns
True if the socket is open, false otherwise
bool Radiant::TCPServerSocket::isPendingConnection ( unsigned int  waitMicroSeconds = 0)

Check for pending connections Checks for pending connections and optionally blocks for the given timeout.

Parameters
waitMicroSecondsmicro seconds to block
Returns
true if there are pending connections
int Radiant::TCPServerSocket::open ( const char *  host,
int  port,
int  maxconnections = 2 
)

Opens a server TCP socket to desired host:port.

Parameters
hostHostname
portPort number
maxconnectionsMaximum number of pending connections
Returns
On successful execution, returns zero, otherwise an error code (as in errno.h).
int Radiant::TCPServerSocket::port ( ) const

Returns the port number.

Returns
Port number of the socket