Chapterبەش 6 · Lectureوانە 6.3
Inside a TCP Connection: Handshake, Windows and Reliabilityناو پەیوەندییەکی TCP: سێ ڕێی تەوقەکردن، پەنجەرەکان و پشتپێبەستراوی
How TCP opens a connection with the three-way handshake, numbers and acknowledges bytes, puts segments in order, controls the flow with a sliding window, resends what was lost, avoids congestion, closes with FIN and ACK, and which states netstat shows.
چۆن بە پەیوەندییەک دەکاتەوە، ژمارە دەکات و دانیان پێدا دەنێت، ڕیز دەکاتەوە، بە دەکات، ونبووەکان دووپاتە دەنێرێتەوە، خۆی لە قەرەباڵغی لادەدات، بە FIN و ACK دایدەخات و netstat کام دۆخ پیشان دەدات.
What you will learnچی فێر دەبیت
- Describe the three-way handshake with its flags, sequence and acknowledgement numbers.
- Explain flow control with the window size and the sliding window.
- Explain how TCP finds and resends lost data and how congestion control works.
- Close a connection step by step and read TCP states in netstat.
- بە ئاڵاکان، و ژمارەکانی وەسف بکەیت.
- بە و ڕوون بکەیتەوە.
- ڕوونی بکەیتەوە چۆن ونبوو دەدۆزێتەوە و دووپاتە دەینێرێتەوە و چۆن کار دەکات.
- پەیوەندییەک هەنگاو بە هەنگاو دابخەیت و دۆخەکانی لە netstatـدا بخوێنیتەوە.
The life of a TCP connectionژیانی پەیوەندییەکی TCP
TCP and UDP showed what TCP promises: every byte, in order. This lesson shows how. When two hosts talk over TCP, they first set up a connection, then manage it while data flows, and finally close it. Opening uses the three-way handshake. While data flows, TCP numbers the bytes, acknowledges what arrived, resends what was lost and uses a window to control the flow. Closing uses FIN and ACK segments in both directions. Control bits in the TCP header show where the connection is.
TCP و UDP پیشانی دا چی بەڵێن دەدات: هەموو ، بە ڕیز. ئەم وانەیە پیشان دەدات چۆن. کاتێک دوو بە قسە دەکەن، سەرەتا پەیوەندییەک دادەمەزرێنن، پاشان لە کاتی ڕۆیشتنی بەڕێوەی دەبەن و لە کۆتاییدا دایدەخەن. کردنەوە بەکار دەهێنێت. لە کاتی ڕۆیشتنی ، ژمارە دەکات، دان بەوەدا دەنێت کە گەیشتووە، ونبووەکان دووپاتە دەنێرێتەوە و بۆ بەکار دەهێنێت. داخستن FIN و ACK لە هەردوو ئاڕاستەدا بەکار دەهێنێت. کۆنترۆڵ لە سەردێڕی پیشان دەدەن پەیوەندییەکە لە کوێدایە.
Control bits: the flags in the headerبیتەکانی کۆنترۆڵ: ئاڵاکانی سەردێڕ
The TCP header has eight one-bit flags, the control bits (CTL). A flag set to 1 tells the other side what this segment is for. SYN (synchronise) starts a connection and carries the starting sequence number. ACK says that the acknowledgement number is valid; after the handshake it is set in almost every segment. FIN says “I have finished sending”. RST (reset) ends a connection at once, for example when a segment arrives for a connection that does not exist. PSH asks the receiver to pass the data to the application now, URG marks urgent data, and ECE and CWR carry congestion signals.
سەردێڕی هەشت ئاڵای یەک هەیە، واتە کۆنترۆڵ (CTL). ئاڵایەک کە 1 بێت بە لایەکەی تر دەڵێت ئەم بۆ چییە. SYN (synchronise) پەیوەندییەک دەست پێ دەکات و دەستپێک هەڵدەگرێت. ACK دەڵێت ژمارەی دروستە؛ دوای لە نزیکەی هەموو دانراوە. FIN دەڵێت «ناردنم تەواو کرد». RST (reset) یەکسەر پەیوەندییەک کۆتایی پێ دەهێنێت، بۆ نموونە کاتێک بۆ پەیوەندییەک دەگات کە بوونی نییە. PSH داوا لە وەرگر دەکات ئێستا بداتە ، URG بەپەلە دیاری دەکات و ECE و CWR ئاماژەی قەرەباڵغی هەڵدەگرن.
The three-way handshakeسێ ڕێی تەوقەکردن
Before any data moves, TCP must have a connection, and it builds one in three steps. The Kurdish name «» comes from people shaking hands: the first person holds out a hand, and if the other person agrees, he holds out his hand too, and the handshake — the connection — happens. When you open a website in your browser: (1) your computer sends SYN, as if asking “May I connect to you?”; (2) the server answers SYN-ACK: the ACK means “yes”, and its own SYN asks “May I connect to you too?”; (3) your computer answers with a plain ACK: “Yes, you may.” Now the connection exists in both directions.
پێش ئەوەی هیچ بجووڵێت، دەبێت پەیوەندیی هەبێت و بە سێ هەنگاو دروستی دەکات. ناوی کوردیی «» لە تەوقەکردنی خەڵکەوە هاتووە: کەسی یەکەم دەستی بۆ تەوقە درێژ دەکات و ئەگەر کەسی بەرانبەر ڕازی بێت، ئەویش دەستی درێژ دەکات و تەوقەکردنەکە — واتە پەیوەندییەکە — ڕوو دەدات. کاتێک ماڵپەڕێک لە دەکەیتەوە: (1) کۆمپیوتەرەکەت SYN دەنێرێت، وەک ئەوەی بپرسێت «دەتوانم پەیوەندیت پێوە بکەم؟»؛ (2) بە SYN-ACK وەڵام دەداتەوە: ACK واتە «بەڵێ» و SYNـەکەی خۆی دەپرسێت «ئەی من دەتوانم پەیوەندیت پێوە بکەم؟»؛ (3) کۆمپیوتەرەکەت بە ACKـێکی ئاسایی وەڵام دەداتەوە: «بەڵێ، دەتوانیت.» ئێستا پەیوەندییەکە لە هەردوو ئاڕاستەدا هەیە.


You hold out your hand (SYN). Your friend takes it and holds out his own as well (SYN-ACK). You take his hand too (ACK). Only now are both hands joined: each side knows that the other is ready.
دەستت درێژ دەکەیت (SYN). هاوڕێکەت دەستت دەگرێت و ئەویش دەستی خۆی درێژ دەکات (SYN-ACK). تۆش دەستی ئەو دەگریت (ACK). تەنیا ئێستا هەردوو دەست بەیەکەوەن: هەر لایەک دەزانێت لایەکەی تر ئامادەیە.
Where the analogy stops workingسنووری ئەم نموونەیە
Real hands meet in one movement; TCP needs three separate segments, and each one may be lost and must then be sent again.
دەستی ڕاستەقینە بە یەک جووڵە بەیەک دەگەن؛ پێویستی بە سێ جیایە و هەریەکەیان دەکرێت ون بێت و ئەوکات دەبێت دووپاتە بنێردرێتەوە.
TCP's three-way handshake (SYN, SYN-ACK, ACK) that opens a session, and the four steps (FIN and ACK from both sides) that close it.
(SYN، SYN-ACK و ACK) کە سێشنێکی دەکاتەوە؛ هەروەها ئەو چوار هەنگاوەی کە دایدەخات (FIN و ACK لە هەردوو لاوە).
Watch 0:12–3:05: the three-way handshake.
لە 0:12 تا 3:05 سەیر بکە: .
The three-way handshakeسێ ڕێی تەوقەکردن
The numbers inside the handshakeژمارەکانی ناو سێ ڕێی تەوقەکردن
- SYNهەنگاوی SYN
The client sends a segment with SYN set and its initial sequence number (ISN) in the sequence number field, for example 100. From now on it numbers its bytes from here.
دەنێرێت کە SYNـی تێدا دانراوە و (ISN)ـەکەی لە خانەی ، بۆ نموونە 100. لێرەوە ژمارە دەکات.
- SYN-ACKهەنگاوی SYN-ACK
The server answers with SYN and ACK set. Its acknowledgement number is the client's ISN + 1 (101), and its own ISN goes in the sequence number (300).
بە SYN و ACKـی دانراو وەڵام دەداتەوە. ژمارەی ISNـی + 1ـە (101) و ISNـی خۆی دەچێتە ناو (300).
- ACKهەنگاوی ACK
The client answers with ACK only: sequence number 101, acknowledgement number the server's ISN + 1 (301). Both sides are now ESTABLISHED.
تەنیا بە ACK وەڵام دەداتەوە: 101، ژمارەی ISNـی + 1 (301). ئێستا هەردوو لا ESTABLISHEDـن.
Sequence and acknowledgement numbersژمارەکانی زنجیرە و ژمارەکانی دانپێدانان
TCP numbers bytes, not segments. The sequence number of a segment is the number of its first data byte. The acknowledgement number that comes back is the next byte the receiver expects: it means “I have every byte before this one”. So one ACK can confirm several segments at once. If a segment carries bytes 101 to 1100, the next segment starts at 1101, and the ACK for both says 2101.
ژمارە دەکات، نەک . ژمارەی یەکەم . ژمارەی کە دەگەڕێتەوە داهاتووە کە وەرگر چاوەڕێی دەکات: واتە «هەموو پێش ئەمەم هەیە». بۆیە یەک ACK دەتوانێت لە یەک کاتدا چەند پشتڕاست بکاتەوە. ئەگەر 101 تا 1100 هەڵبگرێت، داهاتوو لە 1101ـەوە دەست پێ دەکات و ACKـی هەردووکیان دەڵێت 2101.
Putting segments back in orderڕیزکردنەوەی بڕەکان
The pieces of one message may travel on different routes, so they can arrive out of order. TCP uses the sequence numbers to put the segments back in their original order before the application sees them: the data stream is rebuilt exactly. UDP is connectionless and does not do this: datagrams that arrive out of order are handed to the application as they come, and a lost datagram is not sent again. Applications that need order on top of UDP, such as voice calls (RTP), number their own packets.
پارچەکانی یەک نامە دەکرێت بە ڕێگای جیاوازدا بڕۆن، بۆیە دەکرێت بە ڕیزی هەڵە بگەن. بەکار دەهێنێت بۆ ئەوەی پێش ئەوەی بیانبینێت بگەڕێنێتەوە سەر ڕیزە ڕەسەنەکەیان: زنجیرەی ڕێک دووپاتە دروست دەکرێتەوە. و ئەمە ناکات: ئەو بە ڕیزی هەڵە دەگەن هەر وەک هاتوون دەدرێنە و ونبوو دووپاتە نانێردرێتەوە. ئەو لە سەر پێویستیان بە ڕیزە، وەک پەیوەندیی دەنگی (RTP)، خۆیان ژمارە دەکەن.
Window size: flow controlقەبارەی پەنجەرە: کۆنترۆڵی ڕەوت
A fast sender must not drown a slow receiver. TCP's answer is flow control between the two hosts: the receiving TCP reports a window size, the number of bytes, counted from the acknowledgement number, that it is ready to receive right now. The window size travels in every TCP segment, from the handshake on. TCP is full duplex, so the client and the server each announce their own window. In this example the client says it can take 5,000 bytes and the web server says 10,000.
نێرەرێکی خێرا نابێت وەرگرێکی خاو نوقم بکات. وەڵامی ـە لە نێوان دوو : وەرگر ڕادەگەیەنێت، واتە ئەو ژمارە لە ژمارەی دەژمێردرێت و ئێستا ئامادەیە وەریبگرێت. لە هەموو دەڕوات، لە . ، بۆیە و هەریەکەیان خۆی ڕادەگەیەنێت. لەم نموونەیەدا دەڵێت دەتوانێت 5,000 وەربگرێت و دەڵێت 10,000.
The sliding windowپەنجەرەی خزۆک
The sender may have up to one window of unacknowledged data on the way; it does not wait for an ACK after every segment. Each ACK that comes back moves the window forward, so new segments may be sent: the window slides along the data. When the receiver's buffer fills up, it advertises a smaller window and the sender slows down; a window of 0 stops it until the receiver has room again.
نێرەر دەتوانێت تا یەک بێ ACK لە ڕێگادا هەبێت؛ دوای هەر چاوەڕێی ACK ناکات. هەر ACKـێک کە دەگەڕێتەوە پەنجەرەکە بەرەو پێش دەبات، بۆیە دەکرێت نوێ بنێردرێن: پەنجەرەکە بە درێژایی دەخزێت. کاتێک وەرگر پڕ دەبێت، بچووکتر ڕادەگەیەنێت و نێرەر خاو دەبێتەوە؛ 0 دەیوەستێنێت تا وەرگر دووپاتە جێی دەبێتەوە.


Why waiting for an ACK after every piece is slow (stop-and-wait), and how a window of several pieces that slides forward with each ACK fixes it.
بۆچی چاوەڕوانکردنی دوای هەر پارچەیەک خاوە (stop-and-wait). ئەم کێشەیە چارەسەر دەکات: چەند پارچەیەک بەبێ چاوەڕوانی دەنێرێت و لەگەڵ هەر بەرەو پێش دەخزێت.
Whole video: stop-and-wait, then the sliding window. The video says frames; TCP does the same with bytes, and the receiver can make the window smaller.
هەموو ڤیدیۆکە: سەرەتا stop-and-wait، پاشان . ڤیدیۆکە باسی دەکات؛ هەمان کار بە بایت دەکات و وەرگر دەتوانێت پەنجەرەکە بچووک بکاتەوە.
Acknowledgements and retransmissionدانپێدانان و دووپاتە ناردنەوە
TCP's reliability rests on three tools: acknowledgements say what has arrived, a retransmission timer notices when an ACK does not come in time, and retransmission sends the missing bytes again. Follow the example. The window is 3,000 bytes: the sender sends bytes 1–1500 and 1501–3000, and the receiver answers ACK 3001. The next segment, 3001–4500, is lost; 4501–6000 arrives. The receiver keeps 4501–6000 in its buffer but can only acknowledge up to the gap, so it answers ACK 3001 again, with a smaller window of 1,500 because its buffer is partly full. Only one repeated ACK comes back here, so the sender waits until the timer runs out and then resends 3001–4500; the receiver can now answer ACK 6001. When more segments follow a loss, three duplicate ACKs make the sender resend sooner, without waiting for the timer (fast retransmit, RFC 5681).
لە سەر سێ ئامراز وەستاوە: دەڵێت چی گەیشتووە، دەزانێت کەی ACKـێک لە کاتی خۆیدا نەهاتووە و ونبووەکان دووپاتە دەنێرێتەوە. نموونەکە ببینە. 3,000 : نێرەر 1–1500 و 1501–3000 دەنێرێت و وەرگر ACK 3001 وەڵام دەداتەوە. دواتر، 3001–4500، ون دەبێت؛ 4501–6000 دەگات. وەرگر 4501–6000 لە هەڵدەگرێت بەڵام تەنیا تا بۆشاییەکە دەتوانێت دانی پێدا بنێت، بۆیە دووپاتە ACK 3001 وەڵام دەداتەوە، بە بچووکتری 1,500، چونکە بەشێکی پڕ بووە. لێرەدا تەنیا یەک ACKـی دووپاتە دەگەڕێتەوە، بۆیە نێرەر چاوەڕێ دەکات تا تەواو دەبێت و پاشان 3001–4500 دووپاتە دەنێرێتەوە؛ ئێستا وەرگر دەتوانێت ACK 6001 وەڵام بداتەوە. کاتێک زیاتر بەدوای ونبوونێکدا دێن، سێ ACKـی دووپاتە وا لە نێرەر دەکەن زووتر و بێ چاوەڕوانیی دووپاتە بنێرێتەوە (fast retransmit، RFC 5681).


Congestion control: sharing the networkکۆنترۆڵی قەرەباڵغی: بەشکردنی ڕایەڵە
Flow control protects the receiver; congestion control protects the network in between. When routers' queues overflow, segments are lost — and that loss is TCP's main signal of congestion. The receiver does not reduce its window because of this; the sender keeps a second limit for itself, the congestion window (cwnd), and never has more than the smaller of cwnd and the receiver's window on the way. A new connection starts with slow start: cwnd begins small and grows by one segment for every ACK, so it roughly doubles each round trip. Above a threshold (ssthresh) it switches to congestion avoidance and grows by about one segment per round trip. Three duplicate ACKs halve it; a timeout drops it back to one segment (RFC 5681). The result is the sawtooth below.
وەرگر دەپارێزێت؛ ئەو لە نێوانیاندایە دەپارێزێت. کاتێک ڕیزەکانی پڕ دەبن، ون دەبن — و ئەو ونبوونە ئاماژەی سەرەکیی بۆ . وەرگر لەبەر ئەمە بچووک ناکاتەوە؛ نێرەر سنوورێکی دووەم بۆ خۆی هەڵدەگرێت، (cwnd). هەرگیز لە بچووکترینی cwnd و وەرگر زیاتری لە ڕێگادا نییە. پەیوەندییەکی نوێ بە دەست پێ دەکات: cwnd بچووک دەست پێ دەکات و بۆ هەر ACKـێک یەک گەورە دەبێت، بۆیە لە هەر گەشتێکی چوون و گەڕانەوەدا نزیکەی دوو هێندە دەبێت. لە سەرووی سنوورێکەوە (ssthresh) دەچێتە سەر خۆلادان لە قەرەباڵغی و لە هەر گەشتێکدا نزیکەی یەک گەورە دەبێت. سێ ACKـی دووپاتە دەیکەنە نیوە؛ تەواوبوونی کات دەیگەڕێنێتەوە بۆ یەک (RFC 5681). ئەنجامەکە ئەم شێوە ددانەی خوارەوەیە.
Closing a connectionداخستنی پەیوەندییەک
A TCP connection has two directions, and each one is closed on its own with FIN and ACK — four segments in all, sometimes called the four-way handshake. (1) The client sends FIN: “I have nothing more to send.” (2) The server ACKs it; it may still send its own last data. (3) When it has finished, the server sends its FIN. (4) The client ACKs it and waits a while in TIME_WAIT (2 × MSL; RFC 9293 takes the MSL as 2 minutes, and systems often use less) so that a late segment cannot confuse a new connection. Often the server's ACK and FIN travel together in one segment. A RST instead ends the connection at once, without this exchange.
پەیوەندییەکی دوو ئاڕاستەی هەیە و هەریەکەیان بە جیا بە FIN و ACK دادەخرێت — سەرجەم چوار ، کە هەندێک جار پێی دەگوترێت تەوقەی چوار ڕێ. (1) FIN دەنێرێت: «هیچی ترم نییە بینێرم.» (2) ACKـی بۆ دەنێرێت؛ هێشتا دەتوانێت دوایین خۆی بنێرێت. (3) کە تەواو بوو، FINـی خۆی دەنێرێت. (4) ACKـی بۆ دەنێرێت و ماوەیەک لە TIME_WAITـدا چاوەڕێ دەکات (2 × MSL؛ RFC 9293 MSL بە 2 خولەک دادەنێت و سیستەمەکان زۆر جار کەمتر بەکار دەهێنن) بۆ ئەوەی دواکەوتوو پەیوەندییەکی نوێ تێک نەدات. زۆر جار ACK و FINـی لە یەک پێکەوە دەڕۆن. RST بەپێچەوانەوە یەکسەر پەیوەندییەکە کۆتایی پێ دەهێنێت، بێ ئەم ئاڵوگۆڕە.


TCP's three-way handshake (SYN, SYN-ACK, ACK) that opens a session, and the four steps (FIN and ACK from both sides) that close it.
(SYN، SYN-ACK و ACK) کە سێشنێکی دەکاتەوە؛ هەروەها ئەو چوار هەنگاوەی کە دایدەخات (FIN و ACK لە هەردوو لاوە).
Watch from 3:05: closing the session in four steps.
لە 3:05ـەوە سەیر بکە: داخستنی سێشنەکە بە چوار هەنگاو.
TCP states in netstatدۆخەکانی TCP لە netstatـدا
Every TCP connection is always in one state, and netstat -an on Windows shows it in the State column. The names are RFC 9293's, written Windows' way (LISTEN appears as LISTENING). The four you will see most: LISTENING — a server program waiting for clients; ESTABLISHED — an open connection; TIME_WAIT — this side closed first and is waiting before the connection disappears (normal; the PID is shown as 0); CLOSE_WAIT — the other side has closed, but the program here has not closed its socket yet. Many CLOSE_WAIT lines that never go away usually mean a program that forgets to close its connections. You saw these states in the netstat example.
هەموو پەیوەندییەکی هەمیشە لە یەک دۆخـدایە و netstat -an لەسەر Windows لە ستوونی Stateـدا پیشانی دەدات. ناوەکان هی RFC 9293ن، بە شێوەی Windows نووسراون (LISTEN وەک LISTENING دەردەکەوێت). ئەو چوارەی زۆرتر دەیانبینیت: LISTENING — بەرنامەیەکی کە چاوەڕێی دەکات؛ ESTABLISHED — پەیوەندییەکی کراوە؛ TIME_WAIT — ئەم لایە یەکەم جار دایخست و پێش نەمانی پەیوەندییەکە چاوەڕێ دەکات (ئاساییە؛ PID وەک 0 پیشان دەدرێت)؛ CLOSE_WAIT — لایەکەی تر دایخستووە، بەڵام بەرنامەکەی ئێرە هێشتا دانەخستووە. زۆر دێڕی CLOSE_WAIT کە هەرگیز ناڕۆن زۆربەی کات واتای بەرنامەیەکە کە لەبیری دەچێت پەیوەندییەکانی دابخات. ئەم دۆخانەت لە نموونەی netstat بینی.
When the handshake is abused: SYN floodsکاتێک سێ ڕێی تەوقەکردن خراپ بەکار دەهێنرێت: SYN flood
After a server answers a SYN with SYN-ACK, it keeps a half-open connection (SYN_RECEIVED) and waits for the final ACK. In a SYN flood an attacker sends huge numbers of SYNs, often with fake source addresses, and never sends the ACK. The server's queue of half-open connections fills up and real clients cannot connect: a denial-of-service attack. Defences include SYN cookies — the server encodes the connection details in its own ISN and keeps no state until the ACK arrives — firewalls and DDoS protection services. Denial-of-service attacks and their defences are taught in network defences.
دوای ئەوەی وەڵامی SYN بە SYN-ACK دەداتەوە، پەیوەندییەکی نیوەکراوە (SYN_RECEIVED) هەڵدەگرێت و چاوەڕێی ACKـی کۆتایی دەکات. لە SYN floodـدا ژمارەیەکی زۆر SYN دەنێرێت (زۆر جار بە ناونیشانی سەرچاوەی ساختە) و هەرگیز ACK نانێرێت. ڕیزی پەیوەندییە نیوەکراوەکانی پڕ دەبێت و ڕاستەقینە ناتوانن پەیوەندی بکەن: هێرشێکی . بەرگرییەکان SYN cookiesـن — زانیاریی پەیوەندییەکە لە ISNـی خۆیدا دەشارێتەوە و تا ACK نەگات هیچ دۆخێک هەڵناگرێت — هەروەها و خزمەتگوزارییەکانی پاراستن لە DDoS. هێرشەکانی و بەرگرییەکانیان لە بەرگرییەکانی ڕایەڵە دەخوێندرێن.
Common mistakesهەڵە باوەکان
Exercisesڕاهێنانەکان
Aram's laptop chooses ISN 5000 and the server chooses ISN 9000. Write the SEQ, ACK and CTL of the three segments.
ئارام ISNـی 5000 هەڵدەبژێرێت و ISNـی 9000. خانەکانی SEQ، ACK و CTLـی سێ بنووسە.
Hintئاماژە
Each ACK is the other side's ISN + 1.
هەر ACKـێک ISNـی لایەکەی ترە + 1.
Show answerوەڵامەکە پیشان بدە
1 laptop → server <SEQ=5000><CTL=SYN>
2 server → laptop <SEQ=9000><ACK=5001><CTL=SYN,ACK>
3 laptop → server <SEQ=5001><ACK=9001><CTL=ACK>In the example of this lesson the client sent SYN, SEQ = 8563 with window 5,000 and the server answered SEQ = 1678, ACK = 8564 with window 10,000. (a) What are the client's SEQ and ACK in the third segment, and which flags does it carry? (b) How many bytes may the server send before it needs an ACK? (c) And the client?
لە نموونەی ئەم وانەیەدا SYN، SEQ = 8563ی بە 5,000 نارد و بە SEQ = 1678، ACK = 8564 و 10,000 وەڵامی دایەوە. (a) SEQ و ACKـی لە سێیەمدا چین و کام ئاڵا هەڵدەگرێت؟ (b) دەتوانێت چەند بنێرێت پێش ئەوەی پێویستی بە ACK بێت؟ (c) ئەی ؟
Show answerوەڵامەکە پیشان بدە
- (a) SEQ = 8564, ACK = 1679, flags: ACK only.
- (b) 5,000 bytes: the server must respect the client's window.
- (c) 10,000 bytes: the server's window. (Congestion control may allow less at first.)
- (a) SEQ = 8564، ACK = 1679، ئاڵا: تەنیا ACK.
- (b) 5,000 : دەبێت ڕێز لە بگرێت.
- (c) 10,000 : . ( لە سەرەتادا ڕەنگە کەمتر ڕێگە بدات.)
A sender has sent bytes 1–6000 in four segments of 1,500 bytes. Segment 2 (1501–3000) is lost; the others arrive. Which ACK numbers does the receiver send, and what happens next?
نێرەرێک 1–6000ی بە چوار 1,500 ناردووە. 2 (1501–3000) ون دەبێت؛ ئەوانی تر دەگەن. وەرگر چ ژمارەیەکی ACK دەنێرێت و پاشان چی ڕوو دەدات؟
Hintئاماژە
An ACK names the first missing byte. Count the duplicate ACKs: is it three?
ACK ناوی یەکەم ونبوو دەبات. ACKـە دووپاتەکان بژمێرە: ئایا سێن؟
Show answerوەڵامەکە پیشان بدە
After segment 1: ACK 1501. Segments 3 and 4 each bring back ACK 1501 again (two duplicate ACKs), and the receiver keeps 3001–6000 in its buffer. Fast retransmit needs three duplicate ACKs, so here the sender resends 1501–3000 when its retransmission timer runs out; then the receiver answers ACK 6001 at once.
دوای 1: ACK 1501. 3 و 4 هەریەکەیان دووپاتە ACK 1501 دەهێننەوە (دوو ACKـی دووپاتە) و وەرگر 3001–6000 لە هەڵدەگرێت. ناردنەوەی خێرا (fast retransmit) پێویستی بە سێ ACKـی دووپاتە هەیە، بۆیە لێرەدا نێرەر کاتێک تەواو دەبێت 1501–3000 دووپاتە دەنێرێتەوە؛ پاشان وەرگر یەکسەر ACK 6001 وەڵام دەداتەوە.
Put the closing segments in order and give the client's state after each: ACK from the server, FIN from the client, ACK from the client, FIN from the server.
داخستن ڕیز بکە و دوای هەریەکەیان دۆخی بنووسە: ACK لە ، FIN لە ، ACK لە ، FIN لە .
Show answerوەڵامەکە پیشان بدە
- FIN from the client → FIN_WAIT_1
- ACK from the server → FIN_WAIT_2
- FIN from the server → (the client answers)
- ACK from the client → TIME_WAIT, then CLOSED
- FIN لە ← FIN_WAIT_1
- ACK لە ← FIN_WAIT_2
- FIN لە ← ( وەڵام دەداتەوە)
- ACK لە ← TIME_WAIT، پاشان CLOSED
Summaryپوختە
- Open: SYN, SYN-ACK, ACK — the third segment is a plain ACK. Each side starts from a random ISN and acknowledges the other's ISN + 1.
- Sequence numbers count bytes; the ACK number is the next byte expected. TCP reorders segments; UDP does not.
- The receiver's window size is flow control; the window slides as ACKs arrive.
- Lost data is found by timers and duplicate ACKs and sent again.
- The congestion window (slow start, congestion avoidance; CUBIC today) protects the network.
- Close: FIN and ACK in each direction; TIME_WAIT and CLOSE_WAIT appear in netstat. RFC 9293 is the standard.
- کردنەوە: SYN، SYN-ACK، ACK — سێیەم ACKـێکی ئاساییە. هەر لایەک لە ISNـێکی هەڕەمەکییەوە دەست پێ دەکات و دان بە ISN + 1ی لایەکەی تردا دەنێت.
- دەژمێرن؛ ژمارەی ACK داهاتووی چاوەڕوانکراوە. ڕیز دەکاتەوە؛ نا.
- وەرگر ؛ پەنجەرەکە بە گەیشتنی ACKـەکان دەخزێت.
- ونبوو بە و ACKـی دووپاتە دەدۆزرێتەوە و دووپاتە دەنێردرێتەوە.
- (، خۆلادان لە قەرەباڵغی؛ ئەمڕۆ CUBIC) دەپارێزێت.
- داخستن: FIN و ACK لە هەر ئاڕاستەیەک؛ TIME_WAIT و CLOSE_WAIT لە netstatـدا دەردەکەون. RFC 9293 ستانداردەکەیە.
Lesson complete!وانەکە تەواو بوو!
Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.
Key termsزاراوە سەرەکییەکان
Clients, Servers and Peer-to-Peer: The Application Layerڕاژەخواز، ڕاژەکار و تاکەکان: چینی ئەپ
Related lecturesوانە پەیوەندیدارەکان
- OSI Layers 4 and 5: Transport and Sessionچینەکانی 4 و 5ی OSI: چینی گواستنەوە و چینی سێشن
- How Fast Is a Network? Delay, Bandwidth and Throughputڕایەڵە چەند خێرایە؟ دواکەوتن، پانایی باند و ڕێژەی تێپەڕین
- Network Defences: Firewalls, Segmentation, Monitoring and SIEMبەرگرییەکانی ڕایەڵە: ئاگرەدیوار، بەشبەشکردنی ڕایەڵە، چاودێریی ئاسایش و SIEM
- Windows Network Commandsفەرمانەکانی ڕایەڵە لە Windows
References and further readingسەرچاوەکان و خوێندنەوەی زیاتر
- RFC 9293: Transmission Control Protocol (TCP), 2022
- RFC 6528: Defending against sequence number attacks
- RFC 7323: TCP extensions for high performance (window scaling)
- RFC 5681: TCP congestion control
- RFC 9438: CUBIC for fast and long-distance networks
- IETF datatracker: draft-ietf-ccwg-bbr (BBR congestion control)
- Microsoft Learn: netstat
This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.