silc_socket_udp_stream_create

SYNOPSIS

    SilcStream silc_socket_udp_stream_create(SilcSocket sock,
                                             SilcBool ipv6,
                                             SilcBool connected,
                                             SilcSchedule schedule);

DESCRIPTION

Creates UDP socket stream of the UDP connection indicated by `sock'. The stream can be destroyed by calling the silc_stream_destroy. The `connected' defines whether the socket is in connected or in connectionless state.

Note that, UDP packets may be read only through the notifier callback (see silc_stream_set_notifier), when SILC_STREAM_CAN_READ is returned to the callback. Because of this the notifier callback must be set.

Note that, UDP packet sending using silc_stream_write and receiving with silc_stream_read works only if the `sock' is a UDP socket in a connected state. In connectionless state sending packets with silc_stream_write is possible only if the remote address and port has been set with silc_socket_stream_set_info. If it is not set in connectionless state packets may be sent only by using the silc_net_udp_send function. In connectionless state packets may be received only by using silc_net_udp_receive.

This function returns the created SilcStream or NULL on error.

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.