rasdaman complete source
akgnet_socket.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
34 #ifndef AKGNET_SOCKET_HH
35 #define AKGNET_SOCKET_HH
36 
37 #include "akgnet_fdescr.hh"
38 #include "akgnet_inetaddr.hh"
39 
40 namespace akg
41 {
42 
52 class Socket : public FileDescriptor
53 {
54 public:
56  Socket() throw();
57 
59  SocketAddress getAddress() throw();
60 
64  SocketAddress getPeerAddress() throw();
65 protected:
67  bool createTcpSocket() throw();
68 
69 private:
71  Socket(const Socket&);
73  Socket& operator=(const Socket&);
74 };
75 
83 class ListenSocket : public Socket
84 {
85 public:
87  ListenSocket() throw();
88 
90  ~ListenSocket() throw();
91 
93  bool open(int port) throw();
94 
98  void setQueueSize(int newSize) throw();
99 
101  int getQueueSize() throw();
102 
103 private:
104  int queuesize;
105 
107  ListenSocket(const ListenSocket&);
109  ListenSocket& operator=(const ListenSocket&);
110 };
111 
120 class ServerSocket : public Socket
121 {
122 public:
124  ServerSocket() throw();
125 
127  ~ServerSocket() throw();
128 
130  bool acceptFrom(ListenSocket&) throw();
131 private:
133  ServerSocket(const ServerSocket&);
135  ServerSocket& operator=(const ServerSocket&);
136 };
137 
145 class ClientSocket : public Socket
146 {
147 public:
149  ClientSocket() throw();
150 
152  ~ClientSocket() throw();
153 
155  bool open(const char *serverHost,int serverPort) throw();
156 private:
158  ClientSocket(const ClientSocket&);
160  ClientSocket& operator=(const ClientSocket&);
161 };
162 
163 
164 } // namespace
165 #endif