Stroika Library
3.0d16
Help-Home
Loading...
Searching...
No Matches
WinSock.cpp
1
/*
2
* Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3
*/
4
#include "Stroika/Foundation/StroikaPreComp.h"
5
6
#if qStroika_Foundation_Common_Platform_Windows
7
#include <winsock2.h>
8
9
#include <ws2tcpip.h>
10
#else
11
#error "WINDOWS REQUIRED FOR THIS MODULE"
12
#endif
13
14
#include "Stroika/Foundation/Execution/Platform/Windows/Exception.h"
15
16
#include "WinSock.h"
17
18
using namespace
Stroika::Foundation
;
19
using namespace
Stroika::Foundation::IO;
20
using namespace
Stroika::Foundation::IO::Network
;
21
using namespace
Stroika::Foundation::IO::Network::Platform;
22
using namespace
Stroika::Foundation::IO::Network::Platform::Windows;
23
24
// Not sure why this is necessary, but we get link errors sometimes without it... Maybe a windows makefile issue on regtest apps?
25
// -- LGP 2014-11-06
26
#pragma comment(lib, "Ws2_32.lib")
27
28
/*
29
********************************************************************************
30
******************* Network::Platform::Windows::WinSock ************************
31
********************************************************************************
32
*/
33
bool
WinSock::sStarted_{
false
};
34
35
void
WinSock::ForceStartup ()
36
{
37
Require (not sStarted_);
38
WSADATA wsaData;
// Initialize Winsock
39
int
iResult = ::WSAStartup (MAKEWORD (2, 2), &wsaData);
40
if
(iResult != 0) {
41
Execution::ThrowSystemErrNo (::WSAGetLastError ());
42
}
43
sStarted_ =
true
;
44
}
Stroika::Foundation::IO::Network
Definition
Cryptography/SSL/SocketStream.inl:5
Stroika::Foundation
Definition
BloomFilter.h:22
Library
Sources
Stroika
Foundation
IO
Network
Platform
Windows
WinSock.cpp
Generated by
1.9.8