Post

Interview_TCP/UDP

πŸ“Œ UDP

βœ… What is UDP? - User Datagram Protocol
- conectionless
- unreliable
- check just data error with checksum


βœ… What are the benefits of UDP? and the disadvantages? πŸ‘πŸ» fast
πŸ‘πŸ» less overhead
πŸ‘πŸ» 1:1, 1:N, N:N connection possible
πŸ‘ŽπŸ» packet loss, corruption
πŸ‘ŽπŸ» data can be recieved in different order


βœ… What is UDP checksum? - to check data error
- send data with checksum header

- divide segment into 16bits
- add all, add 1, create checksum
- send data with checksum

- reciever also creates checksum for recieved data
- if it matches, no error
- if doesnt match, error in segment!


βœ… Where is UDP used? - DNS
- SNMP
- RPC, NetBios, syslog, Kerberos, TFTP
- streaming, internet calls

- allow little data loss
- need to send fast


βœ… How is UDP connection? - server, client can be connected 1:1, 1:N, N:N


βœ… What is overhead? - excess usage of computing resource
- such as processing, memory, bandwidth

- extra memory required for supplemental information
- (ex) src to destination
- space eaten up by protocols to acheive certain goal


βœ… What is payload? - actual data to be transmitted


πŸ“Œ 신뒰적 데이터 전솑

πŸ’Š How can we prevent data loss during transmission? - ARQ
- countdown timer
- sliding window


βœ… How long should be countdown timer? - more than travel time
- more than time reciever needs to manage segment


βœ… What is ARQ? - Automatic Repeat Request/Query

- error checking
- reciever feedback
- sender retransmit

- ⭐️ sequence number
- ⭐️ countdown timer
- ⭐️ sliding window


⭐️ What is stop and wait? - Send and wait until ACK response from reciever
- πŸ‘πŸ» reliable, πŸ‘ŽπŸ» but slow


βœ… What is pipeline protocol? - Send packets without waiting for ACK response
- πŸ‘ŽπŸ» cannot solve data packet loss
- πŸ‘ŽπŸ» recieved order might be different
- from HTTP 1.1


⭐️ What is GBN ARQ? - Go-back-N
- send n(window size) packets if not recieved
- sliding window protocol
- cumulative acknowledgement λ‚΄κ°€ μ—¬κΈ°κΉŒμ§„ λ°›μ•˜λ‹€


βœ… What are the benefits, disadvantages of GBN? - πŸ‘πŸ» pipelining
- πŸ‘πŸ» faster than stop-and-wait
- πŸ‘ŽπŸ» send packet multiple times(lost packet + following frames)


⭐️ What is SR? - selective repeate
- only retransmit lost packet


βœ… What is the benefit of SR? - πŸ‘πŸ» pipelining
- πŸ‘πŸ» send only lost packet


πŸ“Œ TCP

βœ… What is TCP? - Transmission control protocol
- Transport layer
- conection oriented
- reliable


βœ… Where is TCP used? - HTTP
- SMTP
- FTP
- SSH


βœ… What is full duplex and point-to-point? - full duplex: μ–‘λ°©ν–₯
- point-to-point: 2개의 μ’…λ‹¨μ μœΌλ‘œ μ—°κ²°


βœ… How is TCP reliable? - checksum
- ARQ
- timer
- sequence number


βœ… What does it mean to be "reliable"? - data integrity
- data is in the right order


βœ… How is TCP connection-orinted? - pre-connection process
- 3 way handshake


βœ… Explain ACK lost scenario in TCP - Segment send to reciever, but ACK from reciever to sender was lost
- Sender sends again same packet
- Reciever already recieved, throw away


βœ… Explain premature timeout scenario in TCP - Reciever recieves, sends ACK
- However, ACK arrvies later than timeout
- Sender thinks packets didnt arrive, so sends again


βœ… Explain cumulative scenario in TCP - Sender sent segment 1, 2
- Reciever recieved, sent ACK 1, 2
- ACK 1 was lost, ACK 2 arrived
- Sender thinks as ACK 2 arrived, ACK 1 has arrived successfully
- Retransmission of data does not occur


βœ… How can TCP know which segment to send? - sequence number


βœ… What are the problems that can occur in TCP? - packet loss
- packet corruption
- reciever overloaded


βœ… How can re realize that a packet is lost? - timeout
- 3 duplicate ACK


βœ… What is 3-way-handshake? - pre-connection-process
- **SYN**
* client: SYN-SENT - **ACK**
* sever: SYN_RCVD - **SYN** * client: ESTABLISHED, sever: ESTABLISHED


βœ… Why not 2-way-handshake? - server needs to check state of client

- 이럴 λ•ŒλŠ” μ—°κ²°λ˜λ©΄ μ•ˆλœλ‹€.
- client request is retransmission of timeout
- TCP connection is over


βœ… How can we confirm message was recieved by server? - with ACK(acknowledgement) message
- server replies with ACK message to confirm that server recieved the message
- ACK message is control signal to (1) confirm it recieved message (2) is ready to recieve message


βœ… What is 4-way-handshake? - To finish connection

- FIN
* client: FIN_WAIT
- ACK
* server: CLOSE_WAIT
- FIN
* client: TIMED_WAIT
* server: LAST_ACK
- ACK
* client: CLOSED
* server:CLOSED


βœ… What is fast retransmission in TCP? - Sender does not wait until timeout
- When Sender recieves identical ACKs for three times, retransmits
- 3 duplicate ACK

- fast bc sender does not wait for timeout


βœ… What is flow control? - prevent reciever recieving too many segments before it could handle
- πŸ’Š control speed

πŸ’Š configure sliding window size
πŸ’Š stop and wait


βœ… How does "flow control" control speed? - take reciever's buffer size into account

πŸ’Š configure sliding window size
πŸ’Š stop and wait


βœ… What is congestion control? - prevent too many packets on network
πŸ’Š AIMD(Additive Increase Multiplicative Decrease)
πŸ’Š slow start
πŸ’Š TCP Tahoe
πŸ’Š TCP RENO


βœ… What happens when network is congested? - latency
- packet loss


TCP πŸ†š GBN - 곡톡점: sliding window, sendbase, sequence number
- GBN: send n(sliding window size) number of segment
- TCP: send only the missing segment


TCP πŸ†š SR - 곡톡점: retransmit only lost segment
- SR: each segment has timer
- TCP: single timer


This post is licensed under CC BY 4.0 by the author.