#include <CServerInstance.h>
Inheritance diagram for CServerInstance:
Public Member Functions | |
CServerInstance (CSocket *pSocket, bool fDeleteSocket=true) | |
CServerInstance (const char *pName, CSocket *pSocket, bool fDeleteSocket=true) | |
CServerInstance (const STD(string)&rName, CSocket *pSocket, bool fDeleteSocket=true) | |
~CServerInstance () | |
CSocket * | getSocket () |
bool | getDeleteFlag () const |
STD (string) getPeername() const | |
unsigned short | getPeerPort () const |
virtual void | OnReadable (istream &rStream) |
virtual void | OnRequest (CSocket *pConnection) |
void | Shutdown () |
virtual | STD (string) DescribeSelf() |
Protected Member Functions | |
void | setSocket (CSocket *sock) |
void | setDelFlag (bool flag) |
Private Member Functions | |
CServerInstance (const CServerInstance &rhs) | |
CServerInstance & | operator= (const CServerInstance &rhs) |
int | operator== (const CServerInstance &rhs) |
Private Attributes | |
CSocket * | m_pPeer |
Pointer to peer socket. | |
bool | m_fDeleteSocket |
True if destructor deletes socket. |
This class is a subclass of the CFileEvent class... OnReadable is overridden by this class, the user, should in turn override this class and override OnRequest(). OnRequest() entered with the application serialization mutex held, and therefore can perform any function which requires global syncrhonization.
Definition at line 321 of file CServerInstance.h.
|
Construct an anonymous server instance:
Definition at line 307 of file CServerInstance.cpp. |
|
Construct a server instance whose name comes from a char* string.
Definition at line 321 of file CServerInstance.cpp. |
|
|
|
The destructor just deletes m_pPeer if m_fDeleteSocket is true. Definition at line 345 of file CServerInstance.cpp. References CSocket::getState(), m_pPeer, and CSocket::Shutdown(). |
|
|
|
Definition at line 349 of file CServerInstance.h. |
|
Determines the port to which the socket is connected on the peer.
Definition at line 387 of file CServerInstance.cpp. References CSocket::getPeer(), and m_pPeer. |
|
Definition at line 346 of file CServerInstance.h. |
|
Called when the socket becomes readable. We get the socket and pass that to OnRequest which is what the user is supposed to override and embed application functionality in.
Reimplemented from CFileEvent. Definition at line 409 of file CServerInstance.cpp. References m_pPeer, OnRequest(), and Shutdown(). |
|
Called when the client has a request of the server. The application has overridden this member in its derived class.
Definition at line 425 of file CServerInstance.cpp. Referenced by OnReadable(). |
|
|
|
|
|
Definition at line 361 of file CServerInstance.h. References m_fDeleteSocket. |
|
Definition at line 358 of file CServerInstance.h. References m_pPeer. |
|
Called when we want to shutdown the server we must:
It's someone else's responsibility to reap these threads and delete the objects. Definition at line 441 of file CServerInstance.cpp. References CSocket::getState(), m_pPeer, CFileEvent::MonitorReadable(), CEvent::setEnable(), and CSocket::Shutdown(). Referenced by OnReadable(). |
|
The name of the object Reimplemented from CFileEvent. |
|
Reimplemented from CNamedObject. |
|
True if destructor deletes socket.
Definition at line 325 of file CServerInstance.h. Referenced by setDelFlag(). |
|
Pointer to peer socket.
Definition at line 324 of file CServerInstance.h. Referenced by getPeerPort(), OnReadable(), setSocket(), Shutdown(), and ~CServerInstance(). |