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.

applicationdataTCPsegmentIPdatagram

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
タブを全て閉じる