BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
362c1f4
Branches
Tags
master
Blinker
src
windows
PlatformInit.cpp
update copyright header
Stefan Schuermans
commited
362c1f4
at 2019-05-04 17:17:10
PlatformInit.cpp
Blame
History
Raw
/* Blinker Copyright 2011-2019 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) { WSACleanup(); std::cerr << "WSAStartup((2, 2), ...) returned (" << (WORD)LOBYTE(wsaData.wVersion) << ", " << (WORD)HIBYTE(wsaData.wVersion) << ")" << std::endl; exit(1); } } /** * @brief destructor */ PlatformInit::~PlatformInit() { WSACleanup(); } } // namespace Blinker