Function silc_packet_stream_create
SYNOPSIS
SilcPacketStream silc_packet_stream_create(SilcPacketEngine engine,
SilcSchedule schedule,
SilcStream stream);
DESCRIPTION
Create new packet stream and use the `stream' as underlaying stream.
Usually the `stream' would be a socket stream, but it can be any
stream. After this function returns, packets can immediately be
sent to and received from the stream.
The `stream' will be owned by the packet stream and will be closed
and destroyed when the packet stream is destroyed. If the packet
stream creation fails the `stream' is left intact.
NOTES
SilcPacketStream cannot be used with silc_stream_* routines (such as
silc_stream_read and silc_stream_write) because of its special nature.
Use the silc_packet_send and the silc_packet_send_ext to send packets.
To read packets you will receive the packet receive callback from
packet engine. Destroy the stream with silc_packet_stream_destroy.
The SilcPacketStream is thread safe. Same context can be safely used
in multi threaded environment.
|