TCP
TCP Segmenti

TCP bağlantı tabanlı (connection-oriented) bir protokoldür. TCP bağlantı tabanlı bir protokol olduğu için iki bilgisayar, üçlü el sıkışma (3-way handshaking) yaptıktan sonra veri alışverişi yapmaya başlar.
TCP, taşıma katmanında alt katmandan gelen verilere bir başlık bilgisi ekler. Başlık bilgisiyle birlikte bu veriye 'TCP Segmenti' denir.
| Offsets> Octet | Octet> Bit | 0>  7 | 0>  6 | 0>  5 | 0>  4 | 0>  3 | 0>  2 | 0>  1 | 0 | 1>  7 | 1>  6 | 1> 5 | 1> 4 | 1> 3 | 1> 2 | 1 | 1> 0 | 2> 7 | 2> 6 | 2> 5 | 2> 4 | 2> 3 | 2 | 2> 1 | 2> 0 | 3> 7 | 3> 6 | 3> 5 | 3> 4 | 3 | 3> 2 | 3> 1 | 3> 0 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 0 | 0 | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Source port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port | Destination port |
| 4 | 32 | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number | Sequence number |
| 8 | 64 | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) | Acknowledgment number (if ACK set) |
| 12 | 96 | Data offset | Data offset | Data offset | Data offset | Reserved 0 0 0 0 | Reserved 0 0 0 0 | Reserved 0 0 0 0 | Reserved 0 0 0 0 | CWR | ECE | URG | ACK | PSH | RST | SYN | FIN | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size | Window Size |
| 16 | 128 | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Checksum | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) | Urgent pointer (if URG set) |
| 20 | 160 | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) |
| ⋮ | ⋮ | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) |
| 56 | 448 | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) | Options (if data offset > 5. Padded at the end with "0" bits if necessary.) |
Kaynak Port (Source Port): Veriyi gönderen bilgisayarın kullandığı TCP portudur.
Hedef Port (Destination Port): Hedef bilgisayarın TCP portudur.
Sıra Numarası (Sequence Number): TCP'nin verinin böldüğü her bir segmentine verdiği numaradır.
Onay Numarası (ACK Number): Alınan bir SYN paketine karşılık olan onay mesajı ACK biti ile gönderilir.
Başlık Uzunluğu (Header Length/Data Offset): TCP başlığının uzunluğunu gösterir.
Rezerve Edilmiş (Reserved): İleride kullanılmak üzere saklı tutulur.
Kod Bitleri ya da Bayraklar (Code Bits or Flags): Segment ile ilgili kontrol bilgilerini taşır.
Pencere (Window): Akış denetimi için kullanılır.
Hata Kontrol Bitleri (Checksum): Segmentin hatalı ulaşıp ulaşmadığını kontrol etmek için kullanılır.
Acil İşaretçisi (Urgent Pointer): Bir verinin acil olarak iletilmek istendiği durumlarda kullanılır.
Seçenek (Option): TCP segmentinin maksimum boyutunun bilgisini taşır.
Veri (Data):Verinin bulunduğu kısım.