BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
e3463e1
Branches
Tags
master
Blinker
src
windows
PlatformInit.cpp
add WSAStartup() for Windows
Stefan Schuermans
commited
e3463e1
at 2017-10-28 20:23:07
PlatformInit.cpp
Blame
History
Raw
/* Blinker Copyright 2011-2014 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #include <winsock2.h> #include <iostream> #include <stdlib.h> #include "PlatformInit.h" namespace Blinker { /** * @brief constructor */ PlatformInit::PlatformInit() { WORD wVersionRequested = MAKEWORD(2, 2); WSADATA wsaData; int err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { std::cerr << "WSAStartup((2, 2), ...) failed" << std::endl; exit(1); } if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { std::cerr << "WSAStartup((2, 2), ...) returned (" << LOBYTE(wsaData.wVersion) << ", " << HIBYTE(wsaData.wVersion) << ")" << std::endl; exit(1); } } /** * @brief destructor */ PlatformInit::~PlatformInit() { WSACleanup(); } } // namespace Blinker