BSD-3-Clause licensed by Kyriakos Papachrysanthou
Maintained by [email protected]
This version can be pinned in stack with:keep-alive-0.2.1.0@sha256:77c18d13c096932f5ecc350468f277540b0bd804f4a770a45080149599d8a05c,1524

Module documentation for 0.2.1.0

Depends on 1 package(full list with versions):

keep-alive

This module allows you to set per-connection keep alive parameters on windows and linux enviroments. For more information on keep alive signals see https://en.wikipedia.org/wiki/Keepalive. See also https://tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/ for a linux specific implementation.

The module is meant to be used in conjuction with the “network” package. However, in order to ensure adaptability, all functions require a socket file descriptor instead of an implementation dependent socket type. For the network package, such a descriptor can be obtained with the withFdSocket function:

 -- sock is a Socket type
 withFdSocket sock $ \fd -> do
    before <- getKeepAliveOnOff fd
    print before -- False
    -- set keep alive on, idle 60 seconds, interval 2 seconds
    rlt <- setKeepAlive fd $ KeepAlive True 60 2
    case rlt of
        Left err -> print err
        Right () -> return ()
    after <- getKeepAliveOnOff fd
    print after -- True

Please note that only the envocing process can manipulate sockets based on their file descriptors.

Changes

Changelog for keep-alive

0.1.1.0

  • Fix build errors

0.2.0.0

  • add return code to OTHER_KEEPALIVE_ERROR

0.2.1.0

  • add darwin support
  • fix windows build
  • add CI and tests

Unreleased changes