Streams
Streams in QUIC provide a lightweight, ordered byte-stream abstraction to an application, and is the actual unit of reliable transmission.
For more details about QUIC Streams (especially stream states), please refer to QUIC Stream.
Stream is actually a inner concept of QUIC, which is organized and managed by engine process as a source of connection
. Thus if your are finding APIs for data transmission on application level, the encapsulated interface would be more suitable.
This page will introduce the basic structure and operations of streams, and with sections like below:
Stream types
Streams can be bidirectional or unidirectional, and can be created by either endpoint.
Here's streams type enumeration xqc_stream_type_t
, which are ususally used in stream creation:
Enum Value | Description |
---|---|
XQC_CLI_BID | Client initiated Bidirectional |
XQC_SVR_BID | Server initiated Bidirectional |
XQC_CLI_UNI | Client initiated Unidirectional |
XQC_SVR_UNI | Server initiated Unidirectional |
Create streams
Actively create new stream
XQUIC supports creation of bidirectional and unidirectional streams in both client and server. In each case, stream serves as a resource of connection, and must be created with a existing connection.
The stream is generated by xqc_create_stream_with_conn and is typically encapsulated into different interfaces due to actual needs:
XQUIC provides a pair of test hosts, in which xqc_stream_create
is defaultly used to create stream in test_client
, and will generate a bidirectional stream:
Refers to xqc_stream_create API for detailed parameters.
test_server
use xqc_stream_create_with_direction
in special cases to create server-inited stream.
Refers to xqc_stream_create_with_direction API for more details.
Passively create new stream
When receiving a unknown stream frame, current host will call xqc_passive_create_stream
to create stream passively.
Refers to xqc_passive_create_stream API for detailed parameters.
Send data on streams
write app data on stream
The app data is actually sent in transport level, which is triggered inside h3_stream sending process.
Refers to xqc_stream_send API for detailed parameters.
Read data on streams
reading app data on stream
XQUIC use xqc_stream_recv
to read data from stream list, and is triggered periodically in main engine process.
Refers to xqc_stream_recv API for detailed parameters.