---
title: "Protocol connection"
description: "Understand how to create and use protocol connections."
url: https://docs.icerpc.dev/icerpc/protocol-connection
docs_index: https://docs.icerpc.dev/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.icerpc.dev/llms.txt).

# Protocol connection

Understand how to create and use protocol connections.

## The protocol connection abstraction

A server, a client connection and a connection cache all manage protocol connections. A protocol connection is an abstraction that:

- holds a transport connection such as a QUIC connection or a TCP connection
- implements an RPC protocol layer over this transport connection

In C#, this abstraction is the [IProtocolConnection](https://code.icerpc.dev/csharp/0.6.x/api/reference/IceRpc.IProtocolConnection.html) interface:

```csharp
namespace IceRpc;

public interface IProtocolConnection : IInvoker, IAsyncDisposable
{
    Task<(TransportConnectionInformation ConnectionInformation, Task ShutdownRequested)> ConnectAsync(
        CancellationToken cancellationToken = default);

    Task ShutdownAsync(CancellationToken cancellationToken = default);
}
```

Even though it's public, a regular application should not use this API directly.

IceRPC provides two implementations of the protocol connection abstraction: [ice](https://docs.icerpc.dev/icerpc/protocols-and-transports/ice-duplex-transports.md) and [icerpc](https://docs.icerpc.dev/icerpc/protocols-and-transports/icerpc-multiplexed-transports.md) protocol connections.

## Creating a protocol connection

In C#, you create a client protocol connection with a [ClientProtocolConnectionFactory](https://code.icerpc.dev/csharp/0.6.x/api/reference/IceRpc.ClientProtocolConnectionFactory.html). For example:

```csharp
var clientProtocolConnectionFactory = new ClientProtocolConnectionFactory(
    connectionOptions,
    connectTimeout: TimeSpan.FromSeconds(10),
    logger: logger);
await using var protocolConnection = clientProtocolConnectionFactory.CreateConnection(serverAddress);
```

This allows you to implement your own custom version of [ClientConnection](https://code.icerpc.dev/csharp/0.6.x/api/reference/IceRpc.ClientConnection.html) or [ConnectionCache](https://code.icerpc.dev/csharp/0.6.x/api/reference/IceRpc.ConnectionCache.html).

There is currently no public API to create server protocol connections; as a result, you can't create your own custom version of [Server](https://code.icerpc.dev/csharp/0.6.x/api/reference/IceRpc.Server.html).
