TcpServer.h

Go to the documentation of this file.
00001 #ifndef __TCPSERVER_H__
00002 #define __TCPSERVER_H__
00003 
00004 /*
00005 
00006 $Header$
00007 
00008 */
00009 
00010 #include <netinet/in.h>
00011 
00012 #include "Poller.h"
00013 #include "TcpConnection.h"
00014 
00015 // Messages.
00016 static const char *const MSG_SOCKET_CANNOT_LISTEN            = "Cannot listen socket (%s).";
00017 static const char *const MSG_SOCKET_CANNOT_ACCEPT_CONNECTION = "Cannot accept imcoming connection (%s).";
00018 
00019 static const unsigned int TCP_SERVER_CONNECTION_QUEUE_SIZE = 16;
00020 
00021 using namespace std;
00022 
00023 #define TCP_SERVER(c) (dynamic_cast<TcpServer *>(c))
00024 
00025 class TcpServer : public Socket
00026 {
00027 
00028 friend class Poller;
00029 
00030   PYLON_OBJECT
00031 
00032 public:
00033 
00034   TcpServer(const String &bindAddress, const String &service);
00035   virtual ~TcpServer();
00036 
00037   virtual int accept(TcpConnection **connection);
00038 
00039   // Signals.
00040   SIGNAL(accepted, TcpConnection *);
00041 
00042 private:
00043 
00044   String _service;
00045   struct sockaddr_in _addr;
00046 };
00047 
00048 #endif

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