Mercurial > code
comparison C++/SocketListener.h @ 278:adcae2bde2f0
Socket: listener now have initializer list constructor
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 23 Oct 2014 18:15:38 +0200 |
parents | b544a599e08e |
children | 836903141476 24085fae3162 |
comparison
equal
deleted
inserted
replaced
277:b544a599e08e | 278:adcae2bde2f0 |
---|---|
19 #ifndef _SOCKET_LISTENER_H_ | 19 #ifndef _SOCKET_LISTENER_H_ |
20 #define _SOCKET_LISTENER_H_ | 20 #define _SOCKET_LISTENER_H_ |
21 | 21 |
22 #include <chrono> | 22 #include <chrono> |
23 #include <functional> | 23 #include <functional> |
24 #include <initializer_list> | |
25 #include <utility> | |
24 #include <vector> | 26 #include <vector> |
25 | 27 |
26 #include "Socket.h" | 28 #include "Socket.h" |
27 | 29 |
28 #if defined(_WIN32) | 30 #if defined(_WIN32) |
173 /** | 175 /** |
174 * Create a socket listener. | 176 * Create a socket listener. |
175 * | 177 * |
176 * @param method the preferred method | 178 * @param method the preferred method |
177 */ | 179 */ |
178 SocketListener(int method = Poll); | 180 SocketListener(int method = PreferredMethod); |
181 | |
182 /** | |
183 * Createa listener with some sockets. | |
184 * | |
185 * @param list the initializer list | |
186 * @param method the preferred method | |
187 */ | |
188 SocketListener(std::initializer_list<std::pair<Socket, int>> list, int method = PreferredMethod); | |
179 | 189 |
180 /** | 190 /** |
181 * Add a socket to listen to. | 191 * Add a socket to listen to. |
182 * | 192 * |
183 * @param s the socket | 193 * @param s the socket |