setsockopt(2) wrapper. Equivalent to setsockopt(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
SetSockOpt(
int level,
int opt_name,
void const* 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 set. |
| opt_val | Buffer holding the option value to set. |
| opt_len | Size in bytes of opt_val. |