AndroMeta  2.0.0
Public Member Functions
Meta::MListener Class Reference

Listen for incoming connections and bind them to a socket. More...

#include <MListener.h>

List of all members.

Public Member Functions

 MListener ()
 ~MListener ()
bool listen (int port)
bool accept (MSocket *socket)
bool accept (MSocket *socket, const mtime &time)
void close ()
int port () const

Detailed Description

Listen for incoming connections and bind them to a socket.

The MListener is one of the most essential components of a server. It listens on a TCP port for incoming connections and binds them to an MSocket or MSocket subclass.


Constructor & Destructor Documentation

Constructor.

Destructor.


Member Function Documentation

bool Meta::MListener::accept ( MSocket socket)

Block until next connection is received, binding the socket object on success.

Parameters:
socketAn existing socket or socket subclass.
Returns:
true on success.
bool Meta::MListener::accept ( MSocket socket,
const mtime time 
)

Block until the next connection is received or timeout has been reached. On success, binds the socket object.

Parameters:
socketAn existing socket or socket subclass.
Returns:
true on success, false if timeout is reached or failure occurs for some other reason.

Stop listening on the port for incoming connections.

bool Meta::MListener::listen ( int  port)

Begin listening on a port for incoming connections. Must be called before accept().

Returns:
true on success. Fails if the port is already in use.
int Meta::MListener::port ( ) const
Returns:
The port number this listener is currently listening on.

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