본문 바로가기
Computer Network/컴퓨터네트워크

[컴퓨터네트워크] 3. Transport Layer (4)

by leziwn.cs 2023. 10. 21.
TCP overview
  • point-to-point
  • connection-oriented: handshaking
  • pipelining: TCP congestion, flow control set window size
  • full duplex data: bi-directional data flow
  • flow controlled
  • congestion controlled
  • reliable, in-order byte stream: no message boundaries
  • cumulative ACKs

 

3.5.1 segment structure

TCP segment structure

▶ source port #, destination port #

▶ sequence number: "이제 n번째 데이터를 보낼게." (byte stram 번호; TCP: byte stream)

▶ ACK number: "(n-1)번째까지 잘 받았어. n번째 데이터를 줘."

▶ header length: options로 인한 가변 header 길이 --> TCP header length 

▶ C E U A P RSF

  • C, E: congestion notification
  • U: urgent data
  • A: ACK
  • P: push
  • RSF (RST, SYN, FIN): connection management

▶ receive window: receiver가 받을 수 있는 byte stream의 양 --> flow control

▶ options: TCP options

▶ application data: Data sent by application layer into TCP transport.

 

TCP sequence numbers, ACKs

▶ sequence number: 보내는 byte stream의 번호

▶ ACK: 받고 싶은 byte stram의 번호

  • cumulative ACK

TCP sequence numbers, ACKs

▶ sender sequence number space:

  • sent, ACKed
  • sent, not yet ACKed ("in flight")
  • usable, but not yet sent
  • not usable

--> window size = sent, not yet ACKed + usable, but not yet sent

 

Q. How receiver handles out-of-order segments? (ACK보낸 순서의 데이터가 아닌, 다른 순서의 데이터가 왔을 때)

A. TCP does not say, it is up to implementor.

  • Drop
  • Buffer에 일단 저장 --> 나중에 delay가 짧아지지만, buffer space 소모

 

Q. Negative ACK이 왔을 때 sender의 대처법:

  • 그거만 보낼게.
  • 그거 다음부터 다 보낼게.

 

Simple telnet scenario

: Host A가 타이핑하면, Host B가 echo back

Simple telnet scenario

 

TCP round trip time, timeout

Q. 적절한 timer 시간 설정 방법?

A. Longer than RTT(Round Trip Time), but RTT varies.

 

Q. RTT 측정 방법?

A. by. 과거의 RTT: 과거의 RTT 샘플링, 샘플들의 평균

  1. SampleRTT
  2. average of SampleRTT

RTT 샘플링

--> retransmitted 데이터에 대해서는 샘플로 이용하지 않는다.

EWMA(지수적 가중 이동 평균)

--> sample이 오래되면, 반영 비율을 낮춘다.

safety margin

--> Premature timeout을 방지하기 위해 "safety margin" 값을 더해준다.