silc_net_tcp_connect

SYNOPSIS

    SilcAsyncOperation silc_net_tcp_connect(const char *local_ip_addr,
                                            const char *remote_ip_addr,
                                            int remote_port,
                                            SilcSchedule schedule,
                                            SilcNetCallback callback,
                                            void *context);

DESCRIPTION

Creates TCP/IP connection to the remote host indicated by `remote_host' which may be hostname or IP address, on the port indicated by `remote_port'. If the `local_ip_addr' is provided the local host is bound to that address before creating the connection. This is asynchronous call, and this function returns before the connection is actually established. The `callback' will be called after the connection is created to deliver the SilcStream for the created connection. This function supports IPv6 if the platform supports it.

The returned SilcAsyncOperation context can be used to control the asynchronous connecting, such as to abort it. If it is aborted using silc_async_abort the `callback' will not be called. If NULL is returned the operation cannot be aborted. If `schedule' is NULL this will call silc_schedule_get_global to try to get global scheduler.