silc_socket_tcp_stream_create

SYNOPSIS

    SilcAsyncOperation
    silc_socket_tcp_stream_create(SilcSocket sock, SilcBool lookup,
                                  SilcBool require_fqdn,
                                  SilcSchedule schedule,
                                  SilcSocketStreamCallback callback,
                                  void *context);

DESCRIPTION

Creates TCP socket stream of the TCP connection indicated by `sock'. The stream can be destroyed by calling the silc_stream_destroy. Data can be sent and received from the stream by calling silc_stream_write and silc_stream_read. The creation process is asynchronous since socket connection information, such as hostname and IP address are resolved, so SilcAsyncOperation is returned which can be used to cancel the creation process. The `callback' will be called to return the created socket stream.

If the `lookup' is TRUE then this will perform IP and hostname lookup for the socket. If the `require_fqdn' is TRUE then the socket must have valid hostname and IP address, otherwise the stream creation will fail. If it is FALSE then only valid IP address is required. Note that, if the `lookup' is FALSE then the hostname, IP and port information will not be available from the socket stream. In that case this will also return NULL as the `callback' is called immediately.

If the silc_stream_set_notifier is called the stream is set to non-blocking mode. If `schedule' is NULL this will call silc_schedule_get_global to try to get global scheduler.