markdown
TCPとIPの基本md a1d8315
lecture/information/networks/tcp-and-ip-basics.lecture.n.md
Download PDF

TCPとIPの基本きほん

date2026-07-14document_iddoc_22924bf62e57626fdcb8d5f41dff3a04descriptionIPのベストエフォート型データグラム転送とTCPの信頼性のあるバイトストリームを区別し、ポート番号とカプセル化を説明する。prerequisitesネットワークの基本type講義statusactiverelateddata/lecture/information/networks/computer-networks-portal.lecture.n.md / data/lecture/information/networks/computer-network-basics.lecture.n.md / data/lecture/information/networks/dns-basics.lecture.n.md
informationnetworksundergraduatelecture
data/lecture/information/networks/computer-network-basics.lecture.n.md

1導入どうにゅう

この講義こうぎでは、IPInternet Protocolによるデータグラム転送てんそうと、TCPTransmission Control Protocolによるバイトストリーム転送てんそうの責務せきむを区別くべつする。IPが提供ていきょうするサービスの限界げんかいを確認かくにんしたうえで、TCPが順序制御じゅんじょせいぎょと再送さいそうによってどのような信頼性しんらいせいを付加ふかするかを説明せつめいする。

2ネットワーク層そうとトランスポート層そう

IPはネットワーク層そうのプロトコルである。IPアドレスIP addressはネットワーク層そうのインタフェースを識別しきべつし、ルータは宛先あてさきIPアドレスのプレフィックスに基もとづいてデータグラムを次つぎホップへ転送てんそうする。経路情報けいろじょうほうを形成けいせいすることをルーティングRouting、その情報じょうほうに従したがって個々ここのデータグラムを転送てんそうすることをフォワーディングForwardingという。

TCPはトランスポート層そうのプロトコルであり、IPの上うえに構成こうせいされる。TCPは後述こうじゅつするポート番号ばんごうとIPアドレスを組くみ合あわせて通信端点つうしんたんてんを識別しきべつし、アプリケーション間かんのデータ転送てんそうを支援しえんする。

3IPのベストエフォート転送てんそう

IPは、上位層じょういそうから受うけ取とったデータをIPデータグラムIP datagramとして宛先あてさきへ転送てんそうする。ただし、IPが提供ていきょうするサービスはベストエフォートBest-effort serviceである。ネットワークの混雑こんざつや機器ききの障害しょうがいなどにより、データグラムが欠落けつらくすることも、送信順序そうしんじゅんじょと異ことなる順序じゅんじょで到着とうちゃくすることも、重複じゅうふくして到着とうちゃくすることもある。IPは、到達とうたつ、到着順序とうちゃくじゅんじょ、重複排除じゅうふくはいじょを保証ほしょうしない。

4TCPの信頼性しんらいせいのあるバイトストリーム

TCPは、接続せつぞくの両端りょうたんに順序付じゅんじょづきバイトストリームOrdered byte streamを提供ていきょうする。TCPはデータへ通とおし番号ばんごうを付与ふよし、受信側じゅしんがわからの確認応答かくにんおうとうAcknowledgment; ACKによって受信状況じゅしんじょうきょうを確認かくにんする。確認応答かくにんおうとうが得えられないデータを再送さいそうし、順序じゅんじょが入いれ替かわったデータを整列せいれつすることにより、アプリケーションへ順序付じゅんじょづきのデータ列れつを渡わたす。

TCPは全二重通信ぜんにじゅうつうしんFull-duplex communicationを支援しえんするため、両方向りょうほうこうへ同時どうじにバイトストリームを転送てんそうできる。ただし、TCPはアプリケーションが送信そうしんした個々ここのメッセージの境界きょうかいを保存ほぞんしない。アプリケーションは、データの長ながさや区切くぎりを独自どくじのプロトコルで表現ひょうげんする必要ひつようがある。

5ポート番号ばんごうとTCP接続せつぞく

IPアドレスがネットワーク層そうのインタフェースを識別しきべつするのに対たいし、ポート番号ばんごうPort numberはTCPなどの特定とくていのトランスポートプロトコルとIPアドレスの文脈ぶんみゃくで通信端点つうしんたんてんを識別しきべつする。TCP接続せつぞくは、送信元そうしんもとIPアドレス、送信元そうしんもとポート番号ばんごう、宛先あてさきIPアドレス、宛先あてさきポート番号ばんごうの組くみによって概念的がいねんてきに識別しきべつできる。

クライアントは一般いっぱんに一時的いちじてきなポート番号ばんごうを使用しようし、サーバは提供ていきょうするサービスに対応たいおうするポート番号ばんごうで接続せつぞくを待まつ。ポート番号ばんごうがあるため、同一どういつのIPアドレスを持もつ計算機けいさんきで複数ふくすうのアプリケーションが通信つうしんできる。

6カプセル化かと通信手順つうしんてじゅん

アプリケーションのデータはTCPセグメントに格納かくのうされ、TCPセグメントはIPデータグラムのペイロードに格納かくのうされる。このように、上位層じょういそうのデータへ下位層かいそうの制御情報せいぎょじょうほうを付加ふかすることをカプセル化かEncapsulationという。

アプリケーションデータ⟶TCPセグメント⟶IPデータグラム

たとえば、HTTP/1.1またはHTTP/2の通信つうしんでは、HTTPのデータをTCPがバイトストリームとして転送てんそうし、そのTCPセグメントをIPがデータグラムとして宛先あてさきへ転送てんそうする。

7保証範囲ほしょうはんい

TCPの信頼性しんらいせいは、接続せつぞくが維持いじされている間あいだに、送信側そうしんがわのバイト列れつを順序じゅんじょどおりに受信側じゅしんがわへ提供ていきょうすることを対象たいしょうとする。障害しょうがいによって接続せつぞくが失敗しっぱいした場合ばあいの最終的さいしゅうてきな配送はいそうや、受信側じゅしんがわのアプリケーションがデータを処理しょりしたことまでは保証ほしょうしない。「TCPは常つねにデータを配送はいそうする」と解釈かいしゃくしてはならない。

8要点ようてん

  • IPはデータグラムをベストエフォートで転送てんそうし、到達とうたつや順序じゅんじょを保証ほしょうしない。
  • TCPはIPの上うえに順序付じゅんじょづきで信頼性しんらいせいのある全二重ぜんにじゅうバイトストリームを構成こうせいする。
  • IPアドレスはネットワーク層そうのインタフェースを識別しきべつし、ポート番号ばんごうはトランスポートプロトコルとIPアドレスの文脈ぶんみゃくで通信端点つうしんたんてんを識別しきべつする。
  • TCPの保証ほしょうは、アプリケーションによる処理完了しょりかんりょうの保証ほしょうとは異ことなる。

9次つぎに進すすむ講義こうぎ

data/lecture/information/networks/dns-basics.lecture.n.md

TCP and IP Fundamentals

data/lecture/information/networks/computer-network-basics.lecture.n.md

1Introduction

This lecture distinguishes datagram forwarding by IPInternet Protocol from byte-stream transport by TCPTransmission Control Protocol. After establishing the limits of the service that IP provides, it explains how TCP adds reliability through sequencing and retransmission.

2Network and Transport Layers

IP is a network-layer protocol. An IP addressIP address identifies a network-layer interface, and routers use a destination IP-address prefix to forward a datagram to its next hop. RoutingRouting constructs route information, whereas forwardingForwarding transfers each datagram according to that information.

TCP is a transport-layer protocol built on IP. It identifies communication endpoints by combining IP addresses with the port numbers introduced below and supports data transfer between applications.

3IP Best-Effort Forwarding

IP carries data received from an upper layer toward a destination as an IP datagramIP datagram. IP provides a best-effort serviceBest-effort service. Network congestion, device failure, and other conditions can cause datagrams to be lost, arrive in a different order from the sending order, or arrive more than once. IP does not guarantee delivery, arrival order, or duplicate suppression.

4TCP Reliable Byte Streams

TCP provides an ordered byte streamOrdered byte stream between the two endpoints of a connection. TCP assigns sequence numbers to data and uses acknowledgmentsAcknowledgment; ACK from the receiver to determine reception status. It retransmits data that has not been acknowledged and reorders data that arrives out of order, thereby delivering an ordered sequence of bytes to the application.

TCP supports full-duplex communicationFull-duplex communication, so byte streams can be carried simultaneously in both directions. TCP does not, however, preserve the boundaries of individual messages sent by an application. An application protocol must represent its own lengths or delimiters.

5Port Numbers and TCP Connections

An IP address identifies a network-layer interface. In the context of a particular transport protocol such as TCP, a port numberPort number combines with an IP address to identify a communication endpoint. Conceptually, a TCP connection can be identified by the combination of source IP address, source port number, destination IP address, and destination port number.

A client generally uses a temporary port number, while a server waits for connections on a port number associated with the service that it provides. Port numbers allow multiple applications on a computer with the same IP address to communicate concurrently.

6Encapsulation and Communication Sequence

Application data is placed in a TCP segment, and the TCP segment is placed in the payload of an IP datagram. Adding lower-layer control information to upper-layer data in this manner is called encapsulationEncapsulation.

applicationdata⟶TCPsegment⟶IPdatagram

For example, in HTTP/1.1 or HTTP/2 communication, TCP carries HTTP data as a byte stream, and IP forwards the TCP segments toward the destination as datagrams.

7Scope of Guarantees

TCP reliability concerns providing the receiver with the sender's bytes in order while the connection remains viable. It does not guarantee eventual delivery after a connection fails, nor does it guarantee that the receiving application has processed the data. TCP must not be interpreted as always delivering data.

8Key Points

  • IP forwards datagrams on a best-effort basis and does not guarantee delivery or order.
  • TCP builds an ordered, reliable, full-duplex byte stream on IP.
  • An IP address identifies a network-layer interface, while a port number identifies an endpoint in the context of a transport protocol and an IP address.
  • TCP's guarantees differ from a guarantee that an application has completed processing.

9Next Lecture

data/lecture/information/networks/dns-basics.lecture.n.md
raw .n.md をコピー
loc をコピー (filepath:line ~ line)
copy share link
copy encoded share link
path をコピー
copy share link
copy encoded share link
copy share link
copy encoded share link
タブを全て閉じる