Closed
Description
These docs currently just refer to POSIX and Win32 APIs, without explaining what they do (or even linking to docs for the corresponding platform APIs):
https://doc.rust-lang.org/std/net/struct.TcpStream.html#method.set_nonblocking
I'd like to have more information here about how other TcpStream methods change their behavior after calling this, possibly with an example.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
frewsxcv commentedon Aug 23, 2017
I'd be happy to make the changes, though I actually don't know what the effects of using
set_nonblocking
are. If anyone knows, would be great if you could sharetbu- commentedon Aug 23, 2017
This will result in
read
,write
,recv
andsend
operations not blocking, i.e. immediately returning from their calls. If the IO operation could be completed correctly, no further action is required. If it could not,EAGAIN
orEWOULDBLOCK
are returned on Unix platforms andWSAEWOULDBLOCK
is returned on Windows. All of these are mapped toio::ErrorKind::WouldBlock
, so on the Rust side of the things, you can simply check whether the return value of the IO operation has kindio::ErrorKind::WouldBlock
, and in this case take the appropriate action.set_nonblocking
methods. #45227frewsxcv commentedon Oct 12, 2017
Opened a PR for TCP methods: #45227
I'll do another PR for the UDP instance of this in a follow-up PR when I have some more time.
Expand docs/examples for TCP `set_nonblocking` methods.
Rollup merge of rust-lang#45227 - frewsxcv:frewsxcv-set-nonblocking, …
Improve docs for UdpSocket::set_nonblocking.
Rollup merge of rust-lang#45449 - frewsxcv:frewsxcv-udp-nonblocking, …
Rollup merge of rust-lang#45449 - frewsxcv:frewsxcv-udp-nonblocking, …