-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
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.)