Skip to content

Allow set_nodelay() on TcpSocket #5510

@gregoire-mullvad

Description

@gregoire-mullvad

Is your feature request related to a problem? Please describe.

It's a bit cumbersome to have to set some options on TcpSocket and others on TcpStream. It would be nice to be able to set all the option on TcpSocket instead. When using a TcpListener this would also mean I only need to set the option once, instead of having to do it on every incoming connection.

Describe the solution you'd like
Add TcpSocket::set_nodelay() (and the corresponding getter, TcpSocket::nodelay().)

Describe alternatives you've considered
I know this is already possible to do by using socket2 to set the option with SockRef::from(&tokio_tcp_socket).set_nodelay(), but that solution is not obvious and require adding an other (direct) dependency to the project. (One also need to be careful to use a compatible version of socket2.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tokioArea: The main tokio crateC-feature-requestCategory: A feature request.M-netModule: tokio/net

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions