My Project
|
#include <EPoll.h>
Public Member Functions | |
EPoll () | |
~EPoll () | |
bool | start (int numberOfThreads, int maxSockets) |
Start the BMAEPoll processing. More... | |
bool | stop () |
Stop and shut down the BMAEPoll processing. More... | |
bool | isStopping () |
Returns a true if the stop command has been requested. More... | |
bool | registerSocket (Socket *socket) |
Register a BMASocket for monitoring by BMAEPoll. More... | |
bool | unregisterSocket (Socket *socket) |
Unregister a BMASocket from monitoring by BMAEPoll. More... | |
int | getDescriptor () |
Return the descriptor for the ePoll socket. More... | |
void | eventReceived (struct epoll_event event) |
Dispatch event to appropriate socket. More... | |
int | processCommand (coreutils::ZString &request, TCPSession &session) override |
Output the threads array to the console. More... | |
void | resetSocket (Socket *socket) |
![]() | |
virtual void | output (std::stringstream &out) |
Public Attributes | |
int | maxSockets |
The maximum number of socket allowed. More... | |
Manage socket events from the epoll system call.
Use this object to establish a socket server using the epoll network structure of Linux.
Use this object to establish the basis of working with multiple sockets of all sorts using the epoll capabilities of the Linux platform. Socket objects can register with EPoll which will establish a communication mechanism with that socket.
The maximum number of sockets to communicate with is specified on the start method.
Threads are used to establish a read queue for epoll. The desired number of threads (or queues) is established by a parameter on the start method.
core::EPoll::EPoll | ( | ) |
The constructor for the BMAEPoll object.
core::EPoll::~EPoll | ( | ) |
The destructor for the BMAEPoll object.
void core::EPoll::eventReceived | ( | struct epoll_event | event | ) |
Dispatch event to appropriate socket.
Receive the epoll events and dispatch the event to the socket making the request.
int core::EPoll::getDescriptor | ( | ) |
Return the descriptor for the ePoll socket.
Use this method to obtain the current descriptor socket number for the epoll function call.
bool core::EPoll::isStopping | ( | ) |
Returns a true if the stop command has been requested.
This method returns a true if the stop() method has been called and the epoll system is shutting.
|
overridevirtual |
Output the threads array to the console.
The processCommand() method displays the thread array to the requesting console via the session passed as parameter.
session | the session to write the requested data to. |
Reimplemented from core::Command.
bool core::EPoll::registerSocket | ( | Socket * | socket | ) |
Register a BMASocket for monitoring by BMAEPoll.
Use registerSocket to add a new socket to the ePoll event watch list. This enables a new BMASocket object to receive events when data is received as well as to write data output to the socket.
socket | a pointer to a BMASocket object. |
bool core::EPoll::start | ( | int | numberOfThreads, |
int | maxSockets | ||
) |
Start the BMAEPoll processing.
Use the start() method to initiate the threads and begin epoll queue processing.
numberOfThreads | the number of threads to start for processing epoll entries. |
maxSockets | the maximum number of open sockets that epoll will manage. |
bool core::EPoll::stop | ( | ) |
Stop and shut down the BMAEPoll processing.
Use the stop() method to initiate the shutdown process for the epoll socket management.
A complete shutdown of all managed sockets will be initiated by this method call.
bool core::EPoll::unregisterSocket | ( | Socket * | socket | ) |
Unregister a BMASocket from monitoring by BMAEPoll.
Use this method to remove a socket from receiving events from the epoll system.
int core::EPoll::maxSockets |
The maximum number of socket allowed.
The maximum number of sockets that can be managed by the epoll system.