|
AndroMeta
2.0.0
|
Listen for incoming connections and bind them to a socket. More...
#include <MListener.h>
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 |
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.
| bool Meta::MListener::accept | ( | MSocket * | socket | ) |
Block until next connection is received, binding the socket object on success.
| socket | An existing socket or socket subclass. |
| 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.
| socket | An existing socket or socket subclass. |
| void Meta::MListener::close | ( | ) |
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().
| int Meta::MListener::port | ( | ) | const |
1.7.6.1