MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / getAddressFamily

Method getAddressFamily

Libraries/Socket/Socket.cpp:22–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#include "Internal/SocketServer.inl"
21
22SC::ResultSocket SC::SocketDescriptor::getAddressFamily(SocketFlags::AddressFamily& addressFamily) const
23{
24 SocketAddress socketInfo;
25
26 socklen_t socketInfoLen = sizeof(socketInfo.handle);
27 if (::getsockname(handle, &socketInfo.handle.reinterpret_as<struct sockaddr>(), &socketInfoLen) == SOCKET_ERROR)
28 {
29#if SC_PLATFORM_WINDOWS
30 const uint32_t nativeError = static_cast<uint32_t>(WSAGetLastError());
31#else
32 const uint32_t nativeError = static_cast<uint32_t>(errno);
33#endif
34 return ResultSocket::withNativeError(SocketError::DescriptorQueryFailed, SocketErrorDetail::GetSocketAddress,
35 nativeError);
36 }

Callers 15

getMethod · 0.80
headMethod · 0.80
putMethod · 0.80
postMultipartMethod · 0.80
sendRawMethod · 0.80
socketClientServerMethod · 0.80
socketServerSnippetMethod · 0.80
createTCPSocketPairMethod · 0.80
createTCPServerMethod · 0.80

Calls 2

ErrorEnum · 0.50
ResultClass · 0.50

Tested by 15

getMethod · 0.64
headMethod · 0.64
putMethod · 0.64
postMultipartMethod · 0.64
sendRawMethod · 0.64
socketClientServerMethod · 0.64
socketServerSnippetMethod · 0.64
createTCPSocketPairMethod · 0.64
createTCPServerMethod · 0.64