source: XMLIO_V2/external/include/Poco/Net/ServerSocket.h @ 80

Last change on this file since 80 was 80, checked in by ymipsl, 14 years ago

ajout lib externe

  • Property svn:eol-style set to native
File size: 4.9 KB
Line 
1//
2// ServerSocket.h
3//
4// $Id: //poco/1.3/Net/include/Poco/Net/ServerSocket.h#1 $
5//
6// Library: Net
7// Package: Sockets
8// Module:  ServerSocket
9//
10// Definition of the ServerSocket class.
11//
12// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
13// and Contributors.
14//
15// Permission is hereby granted, free of charge, to any person or organization
16// obtaining a copy of the software and accompanying documentation covered by
17// this license (the "Software") to use, reproduce, display, distribute,
18// execute, and transmit the Software, and to prepare derivative works of the
19// Software, and to permit third-parties to whom the Software is furnished to
20// do so, all subject to the following:
21//
22// The copyright notices in the Software and this entire statement, including
23// the above license grant, this restriction and the following disclaimer,
24// must be included in all copies of the Software, in whole or in part, and
25// all derivative works of the Software, unless such copies or derivative
26// works are solely in the form of machine-executable object code generated by
27// a source language processor.
28//
29// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35// DEALINGS IN THE SOFTWARE.
36//
37
38
39#ifndef Net_ServerSocket_INCLUDED
40#define Net_ServerSocket_INCLUDED
41
42
43#include "Poco/Net/Net.h"
44#include "Poco/Net/Socket.h"
45#include "Poco/Net/StreamSocket.h"
46
47
48namespace Poco {
49namespace Net {
50
51
52class Net_API ServerSocket: public Socket
53        /// This class provides an interface to a
54        /// TCP server socket.
55{
56public:
57        ServerSocket();
58                /// Creates a server socket.
59                ///
60                /// The server socket must be bound to
61                /// and address and put into listening state.
62
63        ServerSocket(const Socket& socket);
64                /// Creates the ServerSocket with the SocketImpl
65                /// from another socket. The SocketImpl must be
66                /// a ServerSocketImpl, otherwise an InvalidArgumentException
67                /// will be thrown.
68
69        ServerSocket(const SocketAddress& address, int backlog = 64);
70                /// Creates a server socket, binds it
71                /// to the given address and puts it in listening
72                /// state.
73                ///
74                /// After successful construction, the server socket
75                /// is ready to accept connections.
76
77        ServerSocket(Poco::UInt16 port, int backlog = 64);
78                /// Creates a server socket, binds it
79                /// to the given port and puts it in listening
80                /// state.
81                ///
82                /// After successful construction, the server socket
83                /// is ready to accept connections.
84
85        virtual ~ServerSocket();
86                /// Destroys the StreamSocket.
87
88        ServerSocket& operator = (const Socket& socket);
89                /// Assignment operator.
90                ///
91                /// Releases the socket's SocketImpl and
92                /// attaches the SocketImpl from the other socket and
93                /// increments the reference count of the SocketImpl.   
94
95        virtual void bind(const SocketAddress& address, bool reuseAddress = false);
96                /// Bind a local address to the socket.
97                ///
98                /// This is usually only done when establishing a server
99                /// socket. TCP clients should not bind a socket to a
100                /// specific address.
101                ///
102                /// If reuseAddress is true, sets the SO_REUSEADDR
103                /// socket option.
104
105        virtual void bind(Poco::UInt16 port, bool reuseAddress = false);
106                /// Bind a local port to the socket.
107                ///
108                /// This is usually only done when establishing a server
109                /// socket.
110                ///
111                /// If reuseAddress is true, sets the SO_REUSEADDR
112                /// socket option.
113               
114        virtual void listen(int backlog = 64);
115                /// Puts the socket into listening state.
116                ///
117                /// The socket becomes a passive socket that
118                /// can accept incoming connection requests.
119                ///
120                /// The backlog argument specifies the maximum
121                /// number of connections that can be queued
122                /// for this socket.
123
124        virtual StreamSocket acceptConnection(SocketAddress& clientAddr);
125                /// Get the next completed connection from the
126                /// socket's completed connection queue.
127                ///
128                /// If the queue is empty, waits until a connection
129                /// request completes.
130                ///
131                /// Returns a new TCP socket for the connection
132                /// with the client.
133                ///
134                /// The client socket's address is returned in clientAddr.
135
136        virtual StreamSocket acceptConnection();
137                /// Get the next completed connection from the
138                /// socket's completed connection queue.
139                ///
140                /// If the queue is empty, waits until a connection
141                /// request completes.
142                ///
143                /// Returns a new TCP socket for the connection
144                /// with the client.
145
146protected:
147        ServerSocket(SocketImpl* pImpl, bool);
148                /// The bool argument is to resolve an ambiguity with
149                /// another constructor (Microsoft Visual C++ 2005)
150};
151
152
153} } // namespace Poco::Net
154
155
156#endif // Net_ServerSocket_INCLUDED
Note: See TracBrowser for help on using the repository browser.