| 124 | |
| 125 | #if __unix__ |
| 126 | bool Socket::SetTcpKeepAliveOption(int idle, int interval, int count) |
| 127 | { |
| 128 | return |
| 129 | SetOption(SOL_SOCKET, SO_KEEPALIVE, 1) && |
| 130 | SetOption(SOL_TCP, TCP_KEEPIDLE, idle) && |
| 131 | SetOption(SOL_TCP, TCP_KEEPINTVL, interval) && |
| 132 | SetOption(SOL_TCP, TCP_KEEPCNT, count); |
| 133 | } |
| 134 | #endif |
| 135 | |
| 136 | bool Socket::WaitReadable(struct timeval* tv, bool restart) |