|
MoSync 3.2.1
|
Encapsulates MoSync's server connections. Use this class to listen for incoming connections. More...
#include <MAUtil/Server.h>
Public Member Functions | |
| Server (ServerListener *listener) | |
| virtual | ~Server () |
| int | start (const char *url) |
| int | getAddr (MAConnAddr *dst) |
| int | accept (ConnectionListener *cl) |
| void | close () |
| bool | isOpen () const |
Protected Member Functions | |
| virtual void | connEvent (const MAConnEventData &data) |
Protected Attributes | |
| ServerListener * | mListener |
| MAHandle | mServ |
| ConnectionListener * | mCl |
Encapsulates MoSync's server connections. Use this class to listen for incoming connections.
| MAUtil::Server::Server | ( | ServerListener * | listener | ) | [inline] |
| virtual MAUtil::Server::~Server | ( | ) | [virtual] |
Closes the server.
| int MAUtil::Server::start | ( | const char * | url | ) |
Starts the server. This involves opening a socket, binding it to a port, and, for Bluetooth, adding an entry to the service advertisement list. Once this function returns, you should call accept() to begin receiving connections.
| url | A server URL. See maConnect() for details. |
| int MAUtil::Server::getAddr | ( | MAConnAddr * | dst | ) |
Retrieves the local address of this server.
| dst | A pointer to the struct that will receive the address. |
| int MAUtil::Server::accept | ( | ConnectionListener * | cl | ) |
Asynchronously accepts one incoming connection. Will cause either ServerListener::serverAccepted() or ServerListener::serverAcceptFailed() to be called when the operation is complete.
| cl | When a connection is accepted, this will be its listener. |
| void MAUtil::Server::close | ( | ) |
Closes the server. Removes its service advertisement, if any.
| bool MAUtil::Server::isOpen | ( | ) | const |
Returns true if the server is open, false otherwise. The server is considered open once start() succeeds.
| virtual void MAUtil::Server::connEvent | ( | const MAConnEventData & | data | ) | [protected, virtual] |
Implements MAUtil::ConnListener.
ServerListener* MAUtil::Server::mListener [protected] |
MAHandle MAUtil::Server::mServ [protected] |
ConnectionListener* MAUtil::Server::mCl [protected] |