net/SocketDescriptor: add method GetProtocol()

This commit is contained in:
Max Kellermann
2023-11-22 12:05:52 +01:00
committed by Max Kellermann
parent 1239e075b8
commit 60033f3eb4
2 changed files with 19 additions and 0 deletions

View File

@@ -32,6 +32,16 @@ SocketDescriptor::IsStream() const noexcept
return GetType() == SOCK_STREAM;
}
#ifndef _WIN32
int
SocketDescriptor::GetProtocol() const noexcept
{
return GetIntOption(SOL_SOCKET, SO_PROTOCOL, -1);
}
#endif // !_WIN32
#ifdef _WIN32
void