We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Socket::take_error
1 parent 9fe101b commit af5355cCopy full SHA for af5355c
library/std/src/sys/net/connection/socket/hermit.rs
@@ -304,7 +304,8 @@ impl Socket {
304
}
305
306
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
307
- unimplemented!()
+ let raw: c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_ERROR)?;
308
+ if raw == 0 { Ok(None) } else { Ok(Some(io::Error::from_raw_os_error(raw as i32))) }
309
310
311
// This is used by sys_common code to abstract over Windows and Unix.
0 commit comments