Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

servermanager.h

Go to the documentation of this file.
00001 /********************************************************************
00002        Copyright (c) 2001, Lee Patterson & Ant Works Software
00003        http://ssobjects.sourceforge.net
00004 
00005        filename :  servermanager.h
00006        author   :  Lee Patterson (lee@antws.com)
00007 *********************************************************************/
00008 
00009 #ifndef SERVERMANAGER_H
00010 #define SERVERMANAGER_H
00011 
00012 #include "ssobjects.h"
00013 #include "threadutils.h"
00014 #include "simpleserver.h"
00015 #include "linkedlist.h"
00016 #include "simpletime.h"
00017 #include "SimpleDate.h"
00018 
00019 #ifdef _WIN32
00020 # include <time.h>
00021 #else
00022 # include <sys/time.h>
00023 # include <unistd.h>
00024 #endif
00025 
00026 namespace ssobjects
00027 {
00028 
00029 class ServerManager : public ThreadHandler
00030 {
00031   public:
00032     enum {MIN_FREQ=10};
00033   protected:
00034     SocketInstance          m_sListen;
00035     SockAddr              m_saServer;             //what interface and port to bind to
00036     LinkedList<SimpleServer>    m_listSimpleServers;    //list of the handlers that process messages for a connection
00037     unsigned32              m_nIdleFrequency;       //how often idle will be called
00038     unsigned32              m_nMaxConnections;      //how many connections are allowed
00039     bool                    m_bUsingThread;
00040     bool                    m_bPause;      
00041     CSimpleTime             m_serverStartTime;      //when the server started
00042     CSimpleDate             m_serverStartDate;      //when the server started
00043 
00044   public:
00045     ServerManager(
00046       const SockAddr& saBind,
00047       const unsigned32 nFreq,
00048       const unsigned32 nMaxConnections,
00049       const bool bUseThread);
00050     virtual ~ServerManager();
00051 
00052     void startServer();
00053     bool canBind();
00054     virtual threadReturn ThreadHandlerProc(void);
00055     void acceptConnection(SocketInstance& sListen);
00056 
00057     //pure vurtial method in order to create an instance of a simple server
00058     virtual SimpleServer* createServerInstance(
00059       ServerSocket* const psocket,
00060       const SockAddr& saClient,
00061       const unsigned32 nFreq) = 0;
00062 
00063 };
00064 
00065 };
00066 
00067 #endif //SERVERMANAGER_H
00068 

Generated on Thu Nov 8 12:39:25 2001 for SimpleServerObjects by doxygen1.2.11 written by Dimitri van Heesch, © 1997-2001