Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation for TcpStream::set_nonblocking #44050

Closed
mbrubeck opened this issue Aug 22, 2017 · 3 comments
Closed

Improve documentation for TcpStream::set_nonblocking #44050

mbrubeck opened this issue Aug 22, 2017 · 3 comments
Assignees
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@mbrubeck
Copy link
Contributor

mbrubeck commented Aug 22, 2017

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.

@sfackler sfackler added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Aug 23, 2017
@frewsxcv
Copy link
Member

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 share

@tbu-
Copy link
Contributor

tbu- commented Aug 23, 2017

This will result in read, write, recv and send 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 or EWOULDBLOCK are returned on Unix platforms and WSAEWOULDBLOCK is returned on Windows. All of these are mapped to io::ErrorKind::WouldBlock, so on the Rust side of the things, you can simply check whether the return value of the IO operation has kind io::ErrorKind::WouldBlock, and in this case take the appropriate action.

@shepmaster shepmaster added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Aug 25, 2017
@frewsxcv frewsxcv self-assigned this Oct 11, 2017
@frewsxcv
Copy link
Member

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.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Oct 21, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Oct 21, 2017
…r=sfackler

Expand docs/examples for TCP `set_nonblocking` methods.

Part of rust-lang#44050.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Oct 26, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Oct 28, 2017
…r=sfackler

Improve docs for UdpSocket::set_nonblocking.

Closes rust-lang#44050.
kennytm added a commit to kennytm/rust that referenced this issue Oct 28, 2017
…r=sfackler

Improve docs for UdpSocket::set_nonblocking.

Closes rust-lang#44050.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

5 participants