TIP #344: Bring TCP_NODELAY and SO_KEEPALIVE to socket options


TIP:344
Title:Bring TCP_NODELAY and SO_KEEPALIVE to socket options
Version:$Revision: 1.2 $
Author:Alexandre Ferrieux <alexandre dot ferrieux at gmail dot com>
State:Draft
Type:Project
Tcl-Version:8.7
Vote:Pending
Created:Wednesday, 31 December 2008

Abstract

Just expose to script level, via fconfigure, the two most important setsockopt() use cases: TCP_NODELAY (disabling the Nagle agorithm) and SO_KEEPALIVE (sending automatic keepalives).

Background & Rationale

Currently, there is no way to set nodefault values to a Tcl socket's underlying socket options TCP_NODELAY and SO_KEEPALIVE. That is frustrating because all TCP stacks support setsockopt().

Of these two options, the most important I guess is TCP_NODELAY. Indeed, the Nagle algorithm being on by default may introduce unwanted latencies in some specific cases. This TIP does not try to argument about the prevalence of these cases; the ubiquity of setsockopt(TCP_NODELAY) suffices to justify exposing it to script level.

Proposed Change

This TIP proposes to add two boolean [fconfigure] options to sockets: -nodelay (or -nonagle, or -nagle, take your pick) and -keepalive.

Reference Implementation

Pretty trivial; will be provided shortly after validation. The code has even been in place for a long time, though only in the Windows-specific part, and commented/ifdef'ed out...

Copyright

This document has been placed in the public domain.


Powered by Tcl[Index] [History] [Edit] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows