News for hackers. Stuff that matters.
Re:How a little bit of TCP knowledge is essential by daurnimator on Sunday November 22, 2015 @09:24PM (#10612518)
> There is some overlap, yes. TCP_CORK is a mode however. It's silly to introduce the complexity of extra state when a single method call (flushHint()) would suffice.

It is a single call. Note that last sentence from the man page entry: "setting this option forces an explicit flush of pending output, even if TCP_CORK is currently set."

When TCP_CORK is on (turn it on once at socket creation time), the following code is the implementation of your flushHint function:

    int flushHint(int fd) {
        return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &(int){ 1 }, sizeof(int))
    }
Re:How a little bit of TCP knowledge is essential by Ono-Sendai on Tuesday November 24, 2015 @05:42PM (#10624094)
Hi, It sounds like this could be a good shim for flushHint(), as you said, if only on platforms where TCP_CORK is supported (Linux only?).

It's still more complex than just having a flushHint() method built in though, as it involves two modes (TCP_CORK and TCP_NODELAY).

Re:How a little bit of TCP knowledge is essential by daurnimator on Wednesday November 25, 2015 @05:18AM (#10626433)
Other platforms don't have it as simple; but you can accomplish similar things via manipulation of TCP_NODELAY on most systems. e.g. see http://stackoverflow.com/a/22118709/282536
Re:How a little bit of TCP knowledge is essential by Ono-Sendai on Wednesday November 25, 2015 @07:43AM (#10626883)
Yeah. With enough jumping through hoops it's possible. What I am after is a nice, simple, logical API though.