Poller.h

Go to the documentation of this file.
00001 #ifndef __POLLER_H__
00002 #define __POLLER_H__
00003 
00004 /*
00005 
00006 $Header$
00007 
00008 */
00009 
00010 #include <set>
00011 
00012 #include <netinet/in.h>
00013 
00014 #include "Socket.h"
00015 #include "String.h"
00016 
00017 // Session timeout in milliseconds. 0 means no timeout.
00018 static const unsigned int POLLER_SESSION_TIMEOUT = 0;
00019 
00020 // Errors.
00021 static const char *const MSG_POLLER_SELECT              = "Socket select error (%s).";
00022 static const char *const MSG_POLLER_UNKNOWN_CONNECTION  = "Trying to deal with unknown session.";
00023 
00024 using namespace std;
00025 
00026 class Connection;
00027 
00028 class Poller : public Object
00029 {
00030 
00031   PYLON_OBJECT
00032 
00033 public:
00034 
00035   Poller();
00036   virtual ~Poller();
00037 
00038   int add(Socket *sock);
00039   int remove(Socket *sock);
00040   int poll();
00041 
00042 private:
00043 
00044   typedef set<Socket *> SocketList;
00045 
00046   SocketList _sockets;
00047 
00048   int _maxSocket;
00049   fd_set _allSet;
00050   struct timeval _tv;
00051 };
00052 
00053 #endif

Generated on Thu Sep 6 20:11:25 2007 for Pylon Application Platform by  doxygen 1.5.1