コード例 #1
0
        /// <summary>
        /// Connects to the remote endpoint and completes the QUIC handshake.
        /// </summary>
        /// <returns>A <see cref="Task"/> that completes when the QUIC connection has been established.</returns>
        public async Task ConnectAsync(EndPoint remoteEndPoint)
        {
            var serverName = await ConnectClientAsync(remoteEndPoint);

            _connection = CreateNativeConnection(serverName, SourceConnectionId, _config);

            // Start the loops.
            _receiveLoop = ProcessIncomingAsync();
            _sendLoop    = FlushOutgoingAsync();

            // Signal that there's data to send
            SignalSend();

            // Return the task that will complete when established
            await _establishedTcs.Task;

            // Read the Application Protocol
            NativeMethods.quiche_conn_application_proto(_connection, out var appProtoPtr, out var appProtoLen);
            var buf = new byte[(int)appProtoLen];

            Marshal.Copy(appProtoPtr, buf, 0, (int)appProtoLen);
            ApplicationProtocol = new TlsApplicationProtocol(buf);
        }
コード例 #2
0
ファイル: QuicheConfigBuilder.cs プロジェクト: geoffkizer/qrk
 public QuicheConfigBuilder AddApplicationProtocol(TlsApplicationProtocol protocol)
 {
     ApplicationProtocols.Add(protocol);
     return(this);
 }