Skip to content

[tracking] net::TcpStream #499

Open
Open
@dignifiedquire

Description

@dignifiedquire
Member

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

Activity

tomaka

tomaka commented on Nov 11, 2019

@tomaka

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

dignifiedquire commented on Nov 11, 2019

@dignifiedquire
MemberAuthor

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

changed the title [-]Missing properties on net::TcpStream[/-] [+][tracking] net::TcpStream[/+] on Nov 20, 2019
added this to the std parity milestone on Nov 20, 2019
ArtemGr

ArtemGr commented on Apr 16, 2020

@ArtemGr

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

SuperHacker-liuan commented on Jan 23, 2021

@SuperHacker-liuan

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

Fishrock123

Fishrock123 commented on Jan 27, 2021

@Fishrock123
Member

keepalive is an HTTP thing, not a tcp thing?

SuperHacker-liuan

SuperHacker-liuan commented on Jan 28, 2021

@SuperHacker-liuan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    api designOpen design questions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ArtemGr@dignifiedquire@Fishrock123@tomaka@yoshuawuyts

        Issue actions

          [tracking] net::TcpStream · Issue #499 · async-rs/async-std