* Retrieves the last error that occurred for the socket. * * @returns An error code. */
| 83 | * @returns An error code. |
| 84 | */ |
| 85 | int Socket::GetError() const |
| 86 | { |
| 87 | int opt; |
| 88 | socklen_t optlen = sizeof(opt); |
| 89 | |
| 90 | int rc = getsockopt(GetFD(), SOL_SOCKET, SO_ERROR, (char *)&opt, &optlen); |
| 91 | |
| 92 | if (rc >= 0) |
| 93 | return opt; |
| 94 | |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Formats a sockaddr in a human-readable way. |
nothing calls this directly
no outgoing calls
no test coverage detected