Skip to content

Improve documentation for TcpStream::set_nonblocking #44050

Closed
@mbrubeck

Description

@mbrubeck
Contributor

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.

Activity

added
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
on Aug 23, 2017
frewsxcv

frewsxcv commented on Aug 23, 2017

@frewsxcv
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-

tbu- commented on Aug 23, 2017

@tbu-
Contributor

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.

added
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
on Aug 25, 2017
self-assigned this
on Oct 11, 2017
frewsxcv

frewsxcv commented on Oct 12, 2017

@frewsxcv
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.

added 3 commits that reference this issue on Oct 21, 2017
added 2 commits that reference this issue on Oct 26, 2017
added a commit that references this issue on Oct 28, 2017

Rollup merge of rust-lang#45449 - frewsxcv:frewsxcv-udp-nonblocking, …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @mbrubeck@shepmaster@frewsxcv@sfackler@tbu-

      Issue actions

        Improve documentation for `TcpStream::set_nonblocking` · Issue #44050 · rust-lang/rust