#include <socket.hpp>


Public Types | |
| enum | State { Invalid, Created, Bound, Listening } |
Public Member Functions | |
| Server () | |
| Initializes the Server. | |
| Server (IPAddress addr, uint16_t port) | |
| Initializes the Server and binds to the specified address and port. | |
| void | Bind (IPAddress addr, uint16_t port) |
| Bind the Server to the specified address and port. | |
| void | Listen (int maxconn, int backlog=10) |
| Bind the Server to the specified address and port. | |
| T * | Poll () |
| Check for new connection requests. | |
| std::list< T * > | Select (int timeout) |
| Check clients for incoming data and errors, and sends data in their send_buffer. | |
| void | BuryTheDead () |
| Destroys any dead clients, should be called periodically. | |
| State | State () |
| int | Connections () |
| int | MaxConnections () |
Public Attributes | |
| fd_set | read_fds |
| Stores file descriptors for Select(). | |
| fd_set | write_fds |
| Stores file descriptors for Select(). | |
| fd_set | except_fds |
| Stores file descriptors for Select(). | |
| std::size_t | recv_buffer_max |
| Maximum amount of data that will be buffered for recieving per client. | |
| std::size_t | send_buffer_max |
| Maximum amount of data that will be buffered for sending per client. | |
| unsigned int | maxconn |
| Maximum number of connections the server will hold at one time. | |
| std::list< T * > | clients |
| List of connected clients. | |
Protected Attributes | |
| IPAddress | address |
| The address the server will listen on. | |
| uint16_t | port |
| The port the server will listen on in host order. | |
| uint16_t | portn |
| The port the server will listen on in network order. | |
| SOCKET | server |
| Socket handle of the listener. | |
| State | state |
| Current server state. | |
Private Member Functions | |
| void | Initialize () |
| Initializes all data and WinSock if required. | |
| enum Server::State |
Initializes the Server and binds to the specified address and port.
| addr | Address to bind to | |
| port | Port number to bind to |
| void Server< T >::Initialize | ( | ) | [inline, private] |
Initializes all data and WinSock if required.
This is called by every Socket constructor.
| Socket_InitFailed |
Bind the Server to the specified address and port.
Once this succeeds you should call Listen().
| addr | Address to bind to. | |
| port | Port number to bind to. |
| Socket_BindFailed |
| void Server< T >::Listen | ( | int | maxconn, | |
| int | backlog = 10 | |||
| ) | [inline] |
Bind the Server to the specified address and port.
| maxconn | Maximum number of clients to have at one time. | |
| backlog | Number of connections to keep in the queue. |
| Socket_ListenFailed |
| T* Server< T >::Poll | ( | ) | [inline] |
Check for new connection requests.
| std::list<T *> Server< T >::Select | ( | int | timeout | ) | [inline] |
Check clients for incoming data and errors, and sends data in their send_buffer.
If data is recieved, it is added to their recv_buffer.
| Socket_SelectFailed | ||
| Socket_Exception |
| void Server< T >::BuryTheDead | ( | ) | [inline] |
| int Server< T >::Connections | ( | ) | [inline] |
| int Server< T >::MaxConnections | ( | ) | [inline] |
| fd_set Server< T >::except_fds |
Stores file descriptors for Select().
| std::size_t Server< T >::recv_buffer_max |
Maximum amount of data that will be buffered for recieving per client.
| std::size_t Server< T >::send_buffer_max |
Maximum amount of data that will be buffered for sending per client.
Maximum number of connections the server will hold at one time.
The address the server will listen on.
The port the server will listen on in host order.
The port the server will listen on in network order.
1.5.7.1