MCPcopy Create free account
hub / github.com/ElementsProject/elements / NetworkErrorString

Function NetworkErrorString

src/util/sock.cpp:324–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322
323#ifdef WIN32
324std::string NetworkErrorString(int err)
325{
326 wchar_t buf[256];
327 buf[0] = 0;
328 if(FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
329 nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
330 buf, ARRAYSIZE(buf), nullptr))
331 {
332 return strprintf("%s (%d)", std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().to_bytes(buf), err);
333 }
334 else
335 {
336 return strprintf("Unknown error (%d)", err);
337 }
338}
339#else
340std::string NetworkErrorString(int err)
341{

Callers 11

CreateSockTCPFunction · 0.85
ConnectSocketDirectlyFunction · 0.85
SocketSendDataMethod · 0.85
AcceptConnectionMethod · 0.85
SocketEventsMethod · 0.85
BindListenPortMethod · 0.85
SendCompleteMethod · 0.85
RecvUntilTerminatorMethod · 0.85
IsConnectedMethod · 0.85
CloseSocketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected