74 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0,
m_num, dwLanguageId, str, NULL)) {
76 str.erase(str.find_last_not_of(_T(
" \t\n\r\f\v")) + 1);
78 sprintf(str,
m_num >= 0x10000 ? _T(
"Error 0x%X") : _T(
"Error %u"),
m_num);
88#if (NTDDI_VERSION >= NTDDI_WINXPSP2) || (_WIN32_WINNT >= 0x0502)
104 _In_opt_ PCTSTR pNodeName,
105 _In_opt_ PCTSTR pServiceName,
106 _In_opt_
const ADDRINFOT *pHints)
109 if (GetAddrInfo(pNodeName, pServiceName, pHints, &h) == 0) {
SID wrapper class.
Definition: WinSock2.h:94
void free_internal() noexcept override
Frees address information.
Definition: WinSock2.h:133
bool get(_In_opt_ PCTSTR pNodeName, _In_opt_ PCTSTR pServiceName, _In_opt_ const ADDRINFOT *pHints)
Provides protocol-independent translation from a host name to an address.
Definition: WinSock2.h:103
virtual ~addrinfo()
Frees address information.
Definition: WinSock2.h:121
Base abstract template class to support generic object handle keeping.
Definition: Common.h:580
PADDRINFOT handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:585
void attach(_In_opt_ handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:794
handle_type m_h
Object handle.
Definition: Common.h:833
Numerical runtime error.
Definition: Common.h:1390
int error_type
Error number type.
Definition: Common.h:1392
error_type m_num
Numeric error code.
Definition: Common.h:1428
WinSock2 runtime error.
Definition: WinSock2.h:26
tstring msg(_In_opt_ DWORD dwLanguageId=0) const
Returns a user-readable Windows error message.
Definition: WinSock2.h:71
ws2_runtime_error(_In_ const std::string &msg)
Constructs an exception using WSAGetLastError()
Definition: WinSock2.h:53
ws2_runtime_error(_In_ error_type num, _In_ const std::string &msg)
Constructs an exception.
Definition: WinSock2.h:34
ws2_runtime_error(_In_opt_z_ const char *msg=nullptr)
Constructs an exception using WSAGetLastError()
Definition: WinSock2.h:62
ws2_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg=nullptr)
Constructs an exception.
Definition: WinSock2.h:44
std::string tstring
Multi-byte / Wide-character string (according to _UNICODE)
Definition: Common.h:311
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:138
static const PADDRINFOT invalid
Invalid handle value.
Definition: Common.h:590