#include <scim_socket.h>
Public Member Functions | |
| SocketServer (int max_clients=-1) | |
| Default constructor, do nothing. | |
| SocketServer (const SocketAddress &address, int max_clients=-1) | |
| Constructor. | |
| ~SocketServer () | |
| Destructor. | |
| bool | valid () const |
| Test if the server is valid. | |
| bool | create (const SocketAddress &address) |
| Create a socket on an address. | |
| bool | run () |
| Run the server. | |
| bool | is_running () const |
| Check if the server is running. | |
| void | shutdown () |
| Shutdown the server. | |
| bool | close_connection (const Socket &socket) |
| Close a client connection. | |
| int | get_error_number () const |
| Get the number of the last occurred error. | |
| String | get_error_message () const |
| Get the message of the last occurred error. | |
| int | get_max_clients () const |
| Get the max number of socket clients. | |
| void | set_max_clients (int max_clients) |
| Set the max number of clients. | |
| bool | insert_external_socket (const Socket &sock) |
| Insert an external socket into the main loop. | |
| bool | remove_external_socket (const Socket &sock) |
| Remove an external socket which was inserted by insert_external_socket (). | |
| Connection | signal_connect_accept (SocketServerSlotSocket *slot) |
| Connect a slot to socket accept signal. | |
| Connection | signal_connect_receive (SocketServerSlotSocket *slot) |
| Connect a slot to socket receive signal. | |
| Connection | signal_connect_exception (SocketServerSlotSocket *slot) |
| Connect a slot to socket exception signal. | |
Class SocketServer provides basic operations to create a Socket Server, such as create, run etc.
| scim::SocketServer::SocketServer | ( | int | max_clients = -1 |
) |
Default constructor, do nothing.
| scim::SocketServer::SocketServer | ( | const SocketAddress & | address, | |
| int | max_clients = -1 | |||
| ) |
Constructor.
| address | create a server on this address. | |
| max_clients | the max number of socket clients, -1 means unlimited. |
| scim::SocketServer::~SocketServer | ( | ) |
Destructor.
| bool scim::SocketServer::valid | ( | ) | const |
Test if the server is valid.
Reimplemented from scim::Socket.
| bool scim::SocketServer::create | ( | const SocketAddress & | address | ) |
Create a socket on an address.
| address | the address to be listen. |
| bool scim::SocketServer::run | ( | ) |
Run the server.
| bool scim::SocketServer::is_running | ( | ) | const |
Check if the server is running.
| void scim::SocketServer::shutdown | ( | ) |
Shutdown the server.
| bool scim::SocketServer::close_connection | ( | const Socket & | socket | ) |
Close a client connection.
| socket | the client socket object to be closed. |
| int scim::SocketServer::get_error_number | ( | ) | const |
Get the number of the last occurred error.
Reimplemented from scim::Socket.
| String scim::SocketServer::get_error_message | ( | ) | const |
Get the message of the last occurred error.
Reimplemented from scim::Socket.
| int scim::SocketServer::get_max_clients | ( | ) | const |
Get the max number of socket clients.
| void scim::SocketServer::set_max_clients | ( | int | max_clients | ) |
Set the max number of clients.
| max_clients | the max number of socket clients allowed to connect this server. |
| bool scim::SocketServer::insert_external_socket | ( | const Socket & | sock | ) |
Insert an external socket into the main loop.
If data is available on this socket, then the receive signal will be emitted.
| sock | The external socket to be inserted. |
| bool scim::SocketServer::remove_external_socket | ( | const Socket & | sock | ) |
Remove an external socket which was inserted by insert_external_socket ().
| sock | The external socket to be removed. |
| Connection scim::SocketServer::signal_connect_accept | ( | SocketServerSlotSocket * | slot | ) |
Connect a slot to socket accept signal.
Connect a slot to socket accept signal, if a client connection is accepted, this signal will be emitted.
| slot | the slot to be connected to this signal. |
| Connection scim::SocketServer::signal_connect_receive | ( | SocketServerSlotSocket * | slot | ) |
Connect a slot to socket receive signal.
Connect a slot to socket receive signal, if a client send data to this server, this signal will be emitted.
| slot | the slot to be connected to this signal. |
| Connection scim::SocketServer::signal_connect_exception | ( | SocketServerSlotSocket * | slot | ) |
Connect a slot to socket exception signal.
Connect a slot to socket exception signal, if an exception was occurred to a client connection, this signal will be emitted.
| slot | the slot to be connected to this signal. |
1.5.7.1