Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

SocketServer.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *  filename  : SocketServer.h
00003  *  authors   : Salvatore Monforte <salvatore.monforte@ct.infn.it>
00004  *  copyright : (C) 2001 by INFN
00005  ***************************************************************************/
00006 
00007 // $Id:
00008 
00018 #ifndef _SocketServer_h__
00019 #define _SocketServer_h_
00020 
00021 #include <sys/socket.h>
00022 #include <netinet/in.h>
00023 #include <pthread.h>
00024 
00025 #include <list>
00026 #include <string>
00027 
00028 namespace edg {   
00029 namespace workload { 
00030 namespace common {
00031 namespace socket_pp {
00032 
00034 class SocketAgent;
00035 
00044 class SocketServer
00045 {
00046  public:
00047 
00053   SocketServer(int, int=5);
00058   virtual ~SocketServer();
00059 
00064   bool Open();
00065   
00070   bool IsConnectionPending();
00071 
00075   virtual void Close();
00082   virtual SocketAgent* Listen(SocketAgent* = 0);
00083 
00089   void KillAgent(SocketAgent*);
00090 
00091   private:
00092   
00093   struct sockaddr_in myaddr_in;     
00094   pthread_mutex_t* agent_mutex;     
00095   std::string hostname;             
00096   int port;                         
00097   int backlog;                      
00098   std::list<SocketAgent*> agents;   
00100  protected:
00102   int sck;      
00103 };
00104 
00105 } // namespace socket_pp
00106 } // namespace common
00107 } // namespace workload
00108 } // namespace edg
00109 
00110 
00111 #endif
00112 
00113 /*
00114   Local Variables:
00115   mode: c++
00116   End:
00117 */
00118 
00119 
00120 

Generated on Wed Mar 1 00:37:55 2006 for COMMON API - configuration, jobid, ldif2classadi, logger, process, requestad, socket++i, task, utilities by doxygen 1.3.5