Class Protocols.TCP.HappyEyeballs

Description

Establish a TCP/IP socket connection to the given host and port. If successful, resolves with an open File object. Follows the Happy Eyeballs algorithm as defined in RFC 8305.

Example
// Attempt to connect to an HTTP server via either IPv6 or IPv4
    object he = Protocols.TCP.HappyEyeballs();
    he->connect("pike.lysator.liu.se", 80)->then() {
      [Stdio.File sock] = __ARGS__;
       write("Connected socket: %O\n", sock);
    };

Constant CONNECTION_ATTEMPT_DELAY

constant float Protocols.TCP.HappyEyeballs.CONNECTION_ATTEMPT_DELAY

Description

Minimum gap between socket connection attempts


Constant FIRST_ADDRESS_FAMILY_WEIGHTING

constant int Protocols.TCP.HappyEyeballs.FIRST_ADDRESS_FAMILY_WEIGHTING

Description

Number of favoured addresses to attempt before going to the other family


Constant RESOLUTION_DELAY

constant float Protocols.TCP.HappyEyeballs.RESOLUTION_DELAY

Description

If IPv4 results come in first, delay by this many seconds in case IPv6 comes in.


Variable resolver

Protocols.DNS.async_client Protocols.TCP.HappyEyeballs.resolver

Description

DNS resolver to use. Defaults to a vanilla async_client; may be replaced as required.


Method create

Protocols.TCP.HappyEyeballs Protocols.TCP.HappyEyeballs()