Networking Engineering / TCP, UDP & CONNECTION LIFECYCLE / NET-006

TCP Handshake Capture

Explore concept graph

Latihan soal

Eksperimen TCP lokal — tanpa packet capture

Jalankan pada Node 24:

node generation/fixtures/NET-006/tcp-lifecycle.mjs

Output yang seharusnya sama pada loopback yang berfungsi:

tcp-connect=ok
tcp-payload=ACK:hello
tcp-peer-end=true
tcp-refusal=ECONNREFUSED

Interpretasi: connect menandakan stream berhasil tersambung; end berarti peer menyelesaikan arah pengirimannya. ECONNREFUSED pada percobaan baru terjadi setelah listener dihentikan. Node tidak mengeluarkan packet-level TCP flags.

Konsep 1 / 3

Read SYN, SYN-ACK and ACK sequence and acknowledgement fields from a real TCP connection trace.

Coba prediksi atau perbaiki

A capture shows client SYN seq=100, then server SYN+ACK ack=101 and seq=300. What ACK number should the client send for the server's SYN?

Kalau jawabanmu berbeda

Kesalahan yang mungkin: Treating a TCP connect callback as an actual packet-level SYN trace.

Mengapa tidak bekerja: The callback reports a stream API state; it cannot show packet flags, sequence numbers or dropped SYN attempts.

Coba perbaiki: Capture traffic on the correct network interface and identify the actual 4-tuple before interpreting TCP flags.

Periksa hasil sendiri

Hasil yang diharapkan: In a real capture, the three matching packets have consistent source/destination ports and SYN acknowledgment progression.

Kalau berbeda: If packets are missing, check capture timing, interface (lo vs external), privileges and whether the client reused an existing connection.

Konsep 2 / 3

Explain TCP stream ordering and distinguish retransmitted segments or transport timeouts from HTTP error responses.

Coba prediksi atau perbaiki

An HTTP/1.1 client cannot connect and logs a timeout, but captures show repeated SYN packets without SYN-ACK. Can you conclude the backend returned HTTP 503?

Kalau jawabanmu berbeda

Kesalahan yang mungkin: Assuming TCP packet boundaries match application writes or that retransmission proves the application received duplicate requests.

Mengapa tidak bekerja: TCP exposes a stream, and retransmissions repair transport data; application framing and retries operate at other layers.

Coba perbaiki: Follow byte sequence/ACK ranges, then inspect HTTP framing and actual application request logs separately.

Periksa hasil sendiri

Hasil yang diharapkan: ACK progression corresponds to data received in sequence; a real retransmission may be absent on clean loopback.

Kalau berbeda: If a trace shows no retransmissions, do not fabricate one. Use a controlled disposable network impairment lab only when permitted.

Konsep 3 / 3

Differentiate a normal TCP stream EOF, an abort/reset and connection refusal after a listener stops.

Coba prediksi atau perbaiki

After a successful TCP echo session, the server calls socket.end(). Does Node's end event alone prove you captured both FIN packets and the TIME-WAIT duration?

Kalau jawabanmu berbeda

Kesalahan yang mungkin: Equating an EOF callback with a proven FIN packet capture or equating connection refusal with HTTP 5xx.

Mengapa tidak bekerja: A stream API event is not raw packet evidence and a refused connection cannot carry an HTTP response from that listener.

Coba perbaiki: Keep stream logs, TCP packet capture and HTTP response observations as three separate evidence sources.

Periksa hasil sendiri

Hasil yang diharapkan: The fixture prints tcp-connect=ok, tcp-payload=ACK:hello, tcp-peer-end=true and tcp-refusal=ECONNREFUSED.

Kalau berbeda: If local refusal is not observed, verify the exact port/listener lifecycle; if no FIN capture exists, report only stream EOF.

Lima soal diagnosis TCP

Jawab tanpa melihat pembahasan dulu. Kamu bisa memperbaiki jawaban dan mencoba lagi. Kuis ini latihan mandiri dan tidak menyimpan skor atau progres.

Pada SYN client dengan seq=100, server membalas SYN+ACK dengan ack=101. Apa artinya ACK itu?
Server SYN+ACK berisi seq=300. ACK client untuk SYN server seharusnya?
Client menulis dua buffer melalui socket.write(). Apa yang dijamin TCP pada aplikasi penerima?
Dalam capture terlihat SYN berulang tanpa SYN-ACK dan tidak ada respons HTTP. Klasifikasi benar?
Node client mendapat end, lalu koneksi baru setelah server.close() menghasilkan ECONNREFUSED. Bukti yang benar?