getsockopt(2) wrapper. Equivalent to getsockopt(m_socket, level, opt_name, opt_val, opt_len). Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation.
Declared in <util/sock.h>
[[nodiscard]]
virtual
int
GetSockOpt(
int level,
int opt_name,
void* opt_val,
socklen_t* opt_len) const;
0 on success, or -1 on error (with errno set).
The return value should not be discarded.
| Name | Description |
|---|---|
| level | Protocol level at which the option resides. |
| opt_name | Name of the option to query. |
| opt_val | Buffer that receives the option value. |
| opt_len | On input the size of opt_val, on output the actual option size. |