84 if (
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, num, dwLanguageId, wstr, NULL)) {
86 wstr.erase(wstr.find_last_not_of(L
" \t\n\r\f\v") + 1);
89 sprintf(wstr, num >= 0x10000 ? L
"Error 0x%X" : L
"Error %u", num);
101#if (NTDDI_VERSION >= NTDDI_WINXPSP2) || (_WIN32_WINNT >= 0x0502)
187#pragma warning(disable: 4505)
191 _In_opt_ PCSTR pNodeName,
192 _In_opt_ PCSTR pServiceName,
193 _In_opt_
const ADDRINFOA *pHints,
197 INT iResult =
GetAddrInfoA(pNodeName, pServiceName, pHints, &h);
209 _In_opt_ PCWSTR pNodeName,
210 _In_opt_ PCWSTR pServiceName,
211 _In_opt_
const ADDRINFOW *pHints,
215 INT iResult =
GetAddrInfoW(pNodeName, pServiceName, pHints, &h);
ADDRINFOA wrapper class.
Definition WinSock2.h:109
void free_internal() noexcept override
Frees address information.
Definition WinSock2.h:130
virtual ~addrinfo()
Frees address information.
Definition WinSock2.h:118
Base abstract template class to support generic object handle keeping.
Definition Common.h:874
handle_type m_h
Definition Common.h:1126
Numerical runtime error.
Definition Common.h:1331
int error_type
Definition Common.h:1333
ADDRINFOW wrapper class.
Definition WinSock2.h:142
virtual ~waddrinfo()
Frees address information.
Definition WinSock2.h:151
void free_internal() noexcept override
Frees address information.
Definition WinSock2.h:163
WinSock2 runtime error.
Definition WinSock2.h:25
ws2_runtime_error(error_type num)
Constructs an exception.
Definition WinSock2.h:32
ws2_runtime_error()
Constructs an exception using WSAGetLastError()
Definition WinSock2.h:56
ws2_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition WinSock2.h:41
ws2_runtime_error(error_type num, const char *msg)
Constructs an exception.
Definition WinSock2.h:50
ws2_runtime_error(const std::string &msg)
Constructs an exception using WSAGetLastError()
Definition WinSock2.h:64
ws2_runtime_error(const char *msg)
Constructs an exception using WSAGetLastError()
Definition WinSock2.h:72
static std::string message(error_type num, DWORD dwLanguageId=0)
Returns a user-readable Windows error message.
Definition WinSock2.h:81
addrinfo taddrinfo
Multi-byte / Wide-character ADDRINFO wrapper class (according to _UNICODE)
Definition WinSock2.h:175
static INT GetAddrInfoW(PCWSTR pNodeName, PCWSTR pServiceName, const ADDRINFOW *pHints, winstd::waddrinfo &result)
Provides protocol-independent translation from a host name to an address.
Definition WinSock2.h:208
static INT GetAddrInfoA(PCSTR pNodeName, PCSTR pServiceName, const ADDRINFOA *pHints, winstd::addrinfo &result)
Provides protocol-independent translation from a host name to an address.
Definition WinSock2.h:190
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
static const PADDRINFOA invalid
Definition Common.h:884