This example shows how a client can attempt to connect to a server with QUIC and fallback to TCP when the QUIC connection establishment fails - for example, because a middlebox between the client and server does not let QUIC connections through.
The server program creates a server for QUIC and another server for TCP; both servers share the same dispatch pipeline.
The client program first attempts to establish a QUIC connection; if this connection establishment fails, it falls back to a TCP connection.
This example uses QUIC, IceRPC's default multiplexed transport. On Linux and macOS, QUIC requires extra setup steps; see .NET's QUIC platform dependencies.
You can build the client and server applications with:
dotnet buildFirst start the Server program:
cd Server
dotnet runIn a separate terminal, start the Client program:
cd Client
dotnet runIn order to see the fallback to TCP, comment out quicServer.Listen(); in the Server program and restart it: the
client's QUIC connection attempt fails and the client falls back to a TCP connection.