#include <server.h>
Collaboration diagram for Server:

Public Methods | |
| bool | Boot (unsigned short port) |
| void | Run () |
Static Public Methods | |
| Server * | Instance () |
| void | Destroy () |
Private Methods | |
| Server () | |
| ~Server () | |
| Server (const Server &) | |
| Server & | operator= (const Server &) |
| Connection * | AcceptConnection () |
| void | InitFDs () |
| void | Execute () |
| void | ShutdownServer () |
Private Attributes | |
| bool | mShutdown |
| flag indicating whether the server is shutting down | |
| fd_set | mInputFDs |
| array of input sockets that select will test | |
| fd_set | mOutputFDs |
| array of output sockets that select will test | |
| SOCKET | mAcceptor |
| socket that the Server listens to for incoming connections | |
| sockaddr_in | mTo |
| network address of the server listening port | |
| ConnList | mUsers |
| the list of Connections managed by the Server | |
Static Private Attributes | |
| Server * | sInstance = 0 |
| pointer to the singleton Server instance | |
Definition at line 35 of file server.h.
|
|
Constructor for Server Definition at line 22 of file server.cpp. |
|
|
Destructor for Server Definition at line 28 of file server.cpp. References mUsers. |
|
|
|
|
|
AcceptConnection handles an incoming connection request on the server's listening port by creating a Connection object for the socket.
Definition at line 149 of file server.cpp. References mAcceptor. Referenced by Run(). |
|
|
Boot initializes the Server and gets it ready to accept incoming Connections.
Definition at line 62 of file server.cpp. References mAcceptor, and mTo. Referenced by main(). |
|
|
Destroys the singleton instance of Server Definition at line 51 of file server.cpp. References sInstance. Referenced by main(). |
|
|
Execute processes the messages contained in all the input queues of all the connections in the server's user list.
Definition at line 195 of file server.cpp. References mShutdown, and mUsers. Referenced by Run(). |
|
|
InitFDs initializes the server's select queue and then re-registers interest in all the connection's sockets in the server's user list including the server's listening port itself.
Definition at line 175 of file server.cpp. References mAcceptor, mInputFDs, mOutputFDs, and mUsers. Referenced by Run(). |
|
|
Instance retrieves the singleton instance of Server
Definition at line 41 of file server.cpp. References sInstance. Referenced by main(). |
|
|
|
|
|
Run starts the Server running to process incomming connection, input and output requests. It also executes commands from input requests. Definition at line 104 of file server.cpp. References AcceptConnection(), Execute(), InitFDs(), mAcceptor, mInputFDs, mOutputFDs, mShutdown, mUsers, Connection::SendMsg(), and ShutdownServer(). Referenced by main(). |
|
|
ShutdownServer requests each of the connections to disconnect in the server's user list, deletes the connections, and erases them from the user list. It then closes its own listening port. Definition at line 224 of file server.cpp. References mAcceptor, and mUsers. Referenced by Run(). |
|
|
socket that the Server listens to for incoming connections
Definition at line 64 of file server.h. Referenced by AcceptConnection(), Boot(), InitFDs(), Run(), and ShutdownServer(). |
|
|
array of input sockets that select will test
|
|
|
array of output sockets that select will test
|
|
|
flag indicating whether the server is shutting down
|
|
|
network address of the server listening port
Definition at line 66 of file server.h. Referenced by Boot(). |
|
|
the list of Connections managed by the Server
Definition at line 68 of file server.h. Referenced by Execute(), InitFDs(), Run(), ShutdownServer(), and ~Server(). |
|
|
pointer to the singleton Server instance
Definition at line 14 of file server.cpp. |
1.2.17