Skip to content

Happy Eyeballs support in Socket.ConnectAsync #861

Closed
@scalablecory

Description

@scalablecory

This proposal adds APIs needed to implement RFC 8305 "Happy Eyeballs" in Socket.ConnectAsync. This depends on #939.

The simplified description of Happy Eyeballs is that it makes A and AAAA DNS requests in parallel, and then goes back and forth between A and AAAA beginning parallel Connect() at a set interval until it has a connection. This trades more overhead for improved latency of the root ConnectAsync call.

See #26177 (comment) where we decided to explore this as a general Socket feature rather than only SocketsHttpClient.

(API has cancellation support added where there previously hasn't been, to avoid needing to add yet more APIs later. See related #921)

class System.Net.Sockets.Socket
{
    public static bool ConnectAsync (SocketType socketType, ProtocolType protocolType, SocketAsyncEventArgs e, ConnectAlgorithm connectAlgorithm);
}

enum System.Net.Sockets.ConnectAlgorithm
{
    // use existing behavior.
    Default,

    // use a Happy Eyeballs-like algorithm to connect.
    Parallel = 1
}

#26177 would be implemented using this, but is not blocked by it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions