yev_setup_connect_event()

yev_setup_connect_event()#

yev_setup_connect_event() creates and configures a socket for a connection event, setting the destination and source addresses, as well as socket options.

Prototype

int yev_setup_connect_event(
    yev_event_h  yev_event,
    const char  *dst_url,
    const char  *src_url,
    int          ai_family,
    int          ai_flags
);

Parameters

Key

Type

Description

yev_event

yev_event_h

The event handle associated with the connection.

dst_url

const char *

The destination URL for the connection.

src_url

const char *

The local bind address in the format ‘host:port’.

ai_family

int

The address family, default is AF_UNSPEC to allow both IPv4 and IPv6 (AF_INET, AF_INET6).

ai_flags

int

Additional address resolution flags, default is AI_V4MAPPED | AI_ADDRCONFIG.


Return Value

Returns 0 on success, or -1 on failure.

Notes

If a file descriptor is already set in yev_event, it will be closed and replaced with the new socket. This function should be called before yev_start_event().

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples