httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

How to enable the TCP_NODELAY socket option?

Open ienev opened this issue 8 years ago • 2 comments

I'm looking for a way to set socket options at the TCP protocol or the socket level. I've found that when creating a socket there is a flag that controls if the SO_KEEPALIVE socket option is set at the socket level. This however is controlling only one specific option at a specific level. Net::HTTP for example enables TCP_NODELAY but it is in all cases and there isn't even a flag to control it.

ienev avatar Sep 10 '17 17:09 ienev

A permalink to Net::HTTP code that enables TCP_NODELAY: https://github.com/ruby/ruby/blob/d8dbc2dcba43ff36221f6549205d2d4cf64b760c/lib/net/http.rb#L1671

gdubicki avatar Dec 05 '24 17:12 gdubicki

Net::HTTP::Persistent gem enables TCP_NODELAY by default too: https://github.com/drbrain/net-http-persistent/blob/234f3b2c6a0ed044e3c55e3de982257b4860ba0a/lib/net/http/persistent.rb#L519-L520

gdubicki avatar Dec 05 '24 17:12 gdubicki