11 #ifndef ASIO_DETAIL_WINSOCK_INIT_HPP 12 #define ASIO_DETAIL_WINSOCK_INIT_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 20 #if defined(ASIO_WINDOWS) || defined(__CYGWIN__) 27 class winsock_init_base
39 unsigned char major,
unsigned char minor);
41 ASIO_DECL static void manual_startup(data& d);
45 ASIO_DECL static void manual_cleanup(data& d);
47 ASIO_DECL static void throw_on_error(data& d);
50 template <
int Major = 2,
int Minor = 0>
51 class winsock_init :
private winsock_init_base
54 winsock_init(
bool allow_throw =
true)
56 startup(data_, Major, Minor);
58 throw_on_error(data_);
61 winsock_init(
const winsock_init&)
63 startup(data_, Major, Minor);
64 throw_on_error(data_);
91 manual_startup(data_);
96 manual_startup(data_);
101 manual_cleanup(data_);
110 template <
int Major,
int Minor>
111 winsock_init_base::data winsock_init<Major, Minor>::data_;
115 static const winsock_init<>& winsock_init_instance = winsock_init<>(
false);
122 #if defined(ASIO_HEADER_ONLY) 124 #endif // defined(ASIO_HEADER_ONLY) 126 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__) 128 #endif // ASIO_DETAIL_WINSOCK_INIT_HPP