Convert Figma logo to code with AI

microsoft logomsquic

Cross-platform, C implementation of the IETF QUIC protocol, exposed to C, C++, C# and Rust.

4,010
529
4,010
193

Top Related Projects

9,954

A QUIC implementation in pure Go

1,651

QUIC and HTTP/3 implementation in Python

1,127

ngtcp2 project is an effort to implement IETF QUIC protocol

3,719

Async-friendly QUIC implementation in Rust

Quick Overview

MsQuic is Microsoft's implementation of the QUIC transport protocol. It's a cross-platform, general-purpose library designed to be efficient, reliable, and secure. MsQuic supports both client and server implementations and is used in various Microsoft products.

Pros

  • Cross-platform support (Windows, Linux, macOS)
  • High performance and low latency
  • Extensive documentation and examples
  • Active development and maintenance by Microsoft

Cons

  • Relatively new compared to established protocols like TCP
  • Limited ecosystem compared to more mature networking libraries
  • May require more complex setup for certain use cases
  • Learning curve for developers unfamiliar with QUIC

Code Examples

  1. Creating a QUIC connection:
QUIC_STATUS Status;
HQUIC Connection = NULL;

Status = MsQuicOpenConnection(
    Registration,
    QuicConnectionCallback,
    Context,
    &Connection
);
  1. Sending data on a QUIC stream:
QUIC_STATUS Status;
QUIC_BUFFER Buffer = { sizeof(Data), (uint8_t*)Data };

Status = MsQuicStreamSend(
    Stream,
    &Buffer,
    1,
    QUIC_SEND_FLAG_NONE,
    NULL
);
  1. Listening for incoming connections:
QUIC_STATUS Status;
HQUIC Listener = NULL;

Status = MsQuicListenerOpen(
    Registration,
    QuicListenerCallback,
    Context,
    &Listener
);

Getting Started

To use MsQuic in your project:

  1. Clone the repository:

    git clone https://github.com/microsoft/msquic.git
    
  2. Build the library:

    cd msquic
    mkdir build && cd build
    cmake -G 'Unix Makefiles' ..
    cmake --build .
    
  3. Include the MsQuic header in your code:

    #include <msquic.h>
    
  4. Link against the MsQuic library when compiling your application.

For more detailed instructions and platform-specific setup, refer to the official documentation in the repository.

Competitor Comparisons

9,954

A QUIC implementation in pure Go

Pros of quic-go

  • Written in Go, offering better cross-platform compatibility and easier integration with Go-based projects
  • More lightweight and easier to embed in existing applications
  • Active community-driven development with frequent updates

Cons of quic-go

  • Less comprehensive feature set compared to msquic
  • May have lower performance in some scenarios due to Go's runtime overhead
  • Limited platform-specific optimizations

Code Comparison

msquic (C):

QUIC_STATUS
QUIC_API
MsQuicOpen(
    _Out_ const QUIC_API_TABLE** QuicAPI
    )
{
    return MsQuicOpenVersion(QUIC_API_VERSION_2, QuicAPI);
}

quic-go (Go):

func Dial(
    ctx context.Context,
    addr net.Addr,
    tlsConf *tls.Config,
    config *Config,
) (Connection, error) {
    return DialEarly(ctx, addr, tlsConf, config)
}

Both repositories implement the QUIC protocol, but their approaches differ significantly. msquic provides a low-level, high-performance implementation in C, while quic-go offers a more accessible, Go-native approach. The choice between them depends on specific project requirements, performance needs, and the preferred development ecosystem.

1,651

QUIC and HTTP/3 implementation in Python

Pros of aioquic

  • Written in Python, making it more accessible for rapid prototyping and integration with Python-based projects
  • Designed specifically for asyncio, providing seamless integration with asynchronous Python applications
  • Smaller codebase, potentially easier to understand and contribute to

Cons of aioquic

  • May have lower performance compared to msquic's C implementation
  • Less mature and less widely adopted than msquic
  • Limited platform support compared to msquic's cross-platform capabilities

Code Comparison

msquic (C):

QUIC_STATUS
QUIC_API
MsQuicOpen(
    _Out_ const QUIC_API_TABLE** QuicAPI
    )
{
    return MsQuicOpenVersion(QUIC_API_VERSION_2, QuicAPI);
}

aioquic (Python):

async def connect(
    host: str,
    port: int,
    configuration: QuicConfiguration,
    create_protocol: Callable = QuicConnectionProtocol,
    wait_connected: bool = True,
) -> Tuple[QuicConnection, asyncio.BaseProtocol]:
    # implementation details

The code snippets highlight the language difference and the async nature of aioquic compared to the more traditional C API of msquic. aioquic's Python implementation allows for more expressive and concise code, while msquic's C code offers lower-level control and potentially better performance.

1,127

ngtcp2 project is an effort to implement IETF QUIC protocol

Pros of ngtcp2

  • Lightweight and focused implementation of QUIC and HTTP/3
  • Extensive test suite and continuous integration
  • Supports multiple platforms and build systems

Cons of ngtcp2

  • Less comprehensive feature set compared to msquic
  • Smaller community and fewer contributors
  • Limited documentation and examples

Code Comparison

msquic:

QUIC_STATUS
QUIC_API
MsQuicOpen(
    _Out_ const QUIC_API_TABLE** QuicAPI
    )
{
    return MsQuicOpenVersion(QUIC_API_VERSION_2, QuicAPI);
}

ngtcp2:

int ngtcp2_conn_client_new(ngtcp2_conn **pconn,
                           const ngtcp2_cid *dcid,
                           const ngtcp2_cid *scid,
                           const ngtcp2_path *path,
                           uint32_t version,
                           const ngtcp2_callbacks *callbacks,
                           const ngtcp2_settings *settings,
                           const ngtcp2_mem *mem,
                           void *user_data)

Both repositories implement QUIC protocol, but msquic offers a more comprehensive solution with additional features and better documentation. ngtcp2 is lighter and more focused on core QUIC functionality. msquic has a larger community and more active development, while ngtcp2 provides a simpler implementation that may be easier to integrate into existing projects.

3,719

Async-friendly QUIC implementation in Rust

Pros of Quinn

  • Written in Rust, offering memory safety and concurrency benefits
  • More active community development with frequent updates
  • Lighter weight and potentially faster due to Rust's performance characteristics

Cons of Quinn

  • Less mature and battle-tested compared to MsQuic
  • Smaller ecosystem and fewer production deployments
  • May lack some advanced features present in MsQuic

Code Comparison

MsQuic (C):

QUIC_STATUS
QUIC_API
MsQuicOpen(
    _Out_ const QUIC_API_TABLE** QuicAPI
    )
{
    return MsQuicOpenVersion(QUIC_API_VERSION_2, QuicAPI);
}

Quinn (Rust):

pub fn new(
    server_config: Arc<ServerConfig>,
    mut endpoint: Endpoint,
) -> Result<Self, ConnectError> {
    let (driver, conn) = Connecting::new(endpoint, server_config)?;
    Ok(Self { driver, conn })
}

Both examples show initialization functions, but Quinn's Rust code is more concise and leverages Rust's safety features. MsQuic's C code demonstrates its lower-level approach and API versioning.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

MsQuic logo

Documentation Perf Dashboard Build Status Test Status Stress Status codecov CodeQL CII Best Practices Discord crates.io nuget

MsQuic is a Microsoft implementation of the IETF QUIC protocol. It is cross-platform, written in C and designed to be a general purpose QUIC library. MsQuic also has C++ API wrapper classes and exposes interop layers for both Rust and C#.

Protocol Features

QUIC has many benefits when compared to existing "TLS over TCP" scenarios:

  • All packets are encrypted and handshake is authenticated with TLS 1.3.
  • Parallel streams of (reliable and unreliable) application data.
  • Exchange application data in the first round trip (0-RTT).
  • Improved congestion control and loss recovery.
  • Survives a change in the clients IP address or port.
  • Stateless load balancing.
  • Easily extendable for new features and extensions.

Library Features

MsQuic has several features that differentiates it from other QUIC implementations:

  • Optimized for client and server.
  • Optimized for maximal throughput and minimal latency.
  • Asynchronous IO.
  • Receive side scaling (RSS) support.
  • UDP send and receive coalescing support.

Documentation

Contributing

For information on contributing, please see our contribution guidelines. Feel free to take a look at our Good First Issues list if you're looking for somewhere to start. If you'd just like to talk, come chat with us on Discord.