Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

tcpserver.hpp

00001 /************************************************************************************
00002  *    This file is part of the MynahSA streaming and archiving toolkit              *
00003  *    Copyright (C) 2006 Mynah-Software Ltd. All Rights Reserved.                   *
00004  *                                                                                  *
00005  *    This program is free software; you can redistribute it and/or modify          *
00006  *    it under the terms of the GNU General Public License, version 2               *
00007  *    as published by the Free Software Foundation.                                 *
00008  *                                                                                  *
00009  *    This program is distributed in the hope that it will be useful,               *
00010  *    but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00011  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00012  *    GNU General Public License for more details.                                  *
00013  *                                                                                  *
00014  *    You should have received a copy of the GNU General Public License along       *
00015  *    with this program; if not, write to the Free Software Foundation, Inc.,       *
00016  *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                   *
00017  *                                                                                  *
00018  ************************************************************************************/
00019 
00020 #ifndef __tcp_server_h
00021 #define __tcp_server_h
00022 
00023 #include <stdexcept>
00024 #include <mynahsa/tcpconnectionmanager.hpp>
00025 
00026 #define ENABLE_THREADED_SERVER
00027 
00028 namespace MynahSA { 
00029   
00031   class TCPServer {
00032   public:
00036     TCPServer(TCPConnectionManager& sobj, 
00037               int port);
00038   
00040     ~TCPServer();
00041   
00042 
00047     void checkClients(int wait_t=0);
00048   
00049   private:
00050     // Create and attach socket.
00051     void bindPort();
00052   
00054     int _port;
00055   
00057     int _master;
00058     
00060     TCPConnectionManager& _serverObject;
00061   };
00062 };
00063 
00064 #endif