net: expose keepalive option on TcpSocket (#6311)

This commit is contained in:
M.Amin Rayej
2024-01-30 21:46:37 +03:30
committed by GitHub
parent 131e7b4e49
commit 9077762545
+10
View File
@@ -185,6 +185,16 @@ impl TcpSocket {
Ok(TcpSocket { inner })
}
/// Sets value for the `SO_KEEPALIVE` option on this socket.
pub fn set_keepalive(&self, keepalive: bool) -> io::Result<()> {
self.inner.set_keepalive(keepalive)
}
/// Gets the value of the `SO_KEEPALIVE` option on this socket.
pub fn keepalive(&self) -> io::Result<bool> {
self.inner.keepalive()
}
/// Allows the socket to bind to an in-use address.
///
/// Behavior is platform specific. Refer to the target platform's