00001 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 5 -*- */ 00002 00003 /* Programm description 00004 */ 00005 00006 /* 00007 * ServerSocket.h 00008 * Utilites 00009 * 00010 * Created by Daniel Aarno on Mon Jan 13 2003. 00011 * Copyright (c) 2003 Daniel Aarno - macbishop@sourceforge.net. 00012 * All rights reserved. 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions are met: 00016 * 00017 * * Redistributions of source code must retain the above copyright notice, 00018 * this list of conditions and the following disclaimer. 00019 * 00020 * * Redistributions in binary form must reproduce the above copyright 00021 * notice, this list of conditions and the following disclaimer in the 00022 * documentation and/or other materials provided with the distribution. 00023 * 00024 * * Neither the name of the Royal Institute of Technology, KTH nor the 00025 * names of its contributors may be used to endorse or promote products 00026 * derived from this software without specific prior written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00029 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00030 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00031 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00032 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00033 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00034 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00035 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00036 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00037 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00038 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 */ 00040 00041 #ifndef _SERVERSOCKET_ 00042 #define _SERVERSOCKET_ 00043 00044 #include "Socket.h" 00045 00046 #ifndef kMaxConnectionQ 00047 #define kMaxConnectionQ 5 00048 #endif 00049 00061 class ServerSocket : public Socket 00062 { 00063 protected: 00065 int port; 00067 int maxConnectQ; 00068 00069 public: 00071 ServerSocket() : Socket(), maxConnectQ(kMaxConnectionQ) {} 00072 00078 ServerSocket(int port) : Socket(), maxConnectQ(kMaxConnectionQ) 00079 { 00080 listen(port); 00081 } 00082 00089 int listen(int port); 00090 00097 Socket accept(); 00098 }; 00099 00100 #endif //_SERVERSOCKET_
1.4.7