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

[tracking] net::TcpStream #499

Open
9 of 17 tasks
dignifiedquire opened this issue Nov 10, 2019 · 6 comments
Open
9 of 17 tasks

[tracking] net::TcpStream #499

dignifiedquire opened this issue Nov 10, 2019 · 6 comments
Labels
api design Open design questions
Milestone

Comments

@dignifiedquire
Copy link
Member

dignifiedquire commented Nov 10, 2019

When working with TcpStream I realized some things are still missing, this is a list for tracking those

  • connect
  • connect_timeout
  • local_addr
  • nodelay
  • peek
  • peer_addr
  • read_timeout
  • set_nodelay
  • set_nonblocking - makes no sense in this context probably
  • set_read_timeout
  • set_ttl
  • set_write_timeout
  • shutdown
  • take_error
  • try_clone (I remember some discussion, so might not be happening)
  • ttl
  • write_timeout
dignifiedquire added a commit to dignifiedquire/async-std that referenced this issue Nov 11, 2019
@tomaka
Copy link

tomaka commented Nov 11, 2019

Aren't all methods that end with _timeout hacks due to the synchronous nature of these operations in the stdlib? Do we really need to reproduce them in an asynchronous context?

@dignifiedquire
Copy link
Member Author

@tomaka they could still be useful, as convenience methods. Alternatively adding some documentation on how to achieve the same effect with the new tooling might be a better way to go.

@yoshuawuyts yoshuawuyts changed the title Missing properties on net::TcpStream [tracking] net::TcpStream Nov 20, 2019
@yoshuawuyts yoshuawuyts added this to the std parity milestone Nov 20, 2019
@yoshuawuyts yoshuawuyts added the api design Open design questions label Nov 20, 2019
@ArtemGr
Copy link

ArtemGr commented Apr 16, 2020

Regarding the read calls.
Let's say that I've asked to read 7 bytes and the other side has sent me 6 bytes ("foobar").

Will the TcpStream::poll_read immediately return me Ready(Ok(6))?
Can I be sure that it won't be Pending until a seventh byte arrives?

And would it make sense to repeat the TcpStream::poll_read with a smaller buffer if invoking it with a larger buffer returns Pending?

Similarly, will an await on the TcpStream::read return the 6 bytes soon as they arrive? Or will it keep waiting for the 7th byte?

This is usually under-specified in, say, the POSIX read calls and hence we have to read byte-by-byte from some streams if we want to access the incoming data as soon as it is available from the network interface. Would be nice to avoid these byte-by-byte reads while using async-std.

@SuperHacker-liuan
Copy link

keepalive & set_keepalive is useful when peer suddenly lose its access to network.

@Fishrock123
Copy link
Member

keepalive is an HTTP thing, not a tcp thing?

@SuperHacker-liuan
Copy link

keepalive is an HTTP thing, not a tcp thing?

FYR, https://tools.ietf.org/html/rfc1122#page-101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api design Open design questions
Projects
None yet
Development

No branches or pull requests

6 participants