# 連接

QUIC 連接是兩個 QUIC 端點之間的單次對話（ conversation ）過程。

QUIC 建立連接時，加密算法的版本協商與傳輸層交握被合併完成以減小建立連接時的延遲。

為了通過這樣的連接實際發送資料，它必須創建和使用一個或多個串流。

## 連接ID ( Connection ID )

每個連接過程都有一組連接標識符，或稱連接ID，該ID用以識別該連接。連接ID由端點獨立選擇，每個端點都選擇其對等方使用的連接ID。

這些連接ID的主要功能是確保較低協定層（ UDP，IP及其底層協定 ）的地址更改不會導致 QUIC 連接的封包傳遞到錯誤的端點。

通過利用連接ID，連接可以以 TCP 永遠無法實現的方式在 IP 地址和網路接口之間遷移。 例如，當客戶端裝置移動到一個有 Wifi 網路的環境時，將正在下載的項目從蜂巢式網路轉已到更快的 Wifi 連接。 同樣，如果 Wifi 不可用時，下載可以繼續通過蜂窩連接進行。

## 端口編號 ( Port numbers )

QUIC 建立在 UDP 之上，因此使用16位元的端口號字段來區分傳入的連接。

## 版本協商 ( Version negotiation )

源自客戶端的 QUIC 連接請求將告訴伺服器端它要使用哪個版本的 QUIC 協定，服務器將響應回覆一個列表包含所支援的版本來供客戶端選擇。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://http3-explained.haxx.se/zh-tw/quic/quic-connections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
