You are on page 1of 2

IP Header

0 16 31
4-bit 4-bit header 8-bit type of service
16-bit total length (in bytes)
version length (TOS)
D M
16-bit identification 0 13-bit fragment offset
F F
8-bit time to live
8-bit protocol 16-bit header checksum 20 bytes
(TTL)

32-bit source IP address

32-bit destination IP address

options (if any)

data

UDP Header
0 16 31
16-bit source port number 16-bit destination port number
8 bytes
16-bit UDP length 16-bit UDP checksum

data (if any)

TCP Header
0 16 31

16-bit source port number 16-bit destination port number

32-bit sequence number

32-bit acknowledgment number 20 bytes

4-bit header reserved U A P R S F


R C S S Y I 16-bit window size
length (6 bits) G K H T N N
16-bit TCP checksum 16-bit urgent pointer

options (if any)

data (if any)

Reprinted from TCP/IP Illustrated, Volume 1: The Protocols


by W. Richard Stevens,
Copyright © 1994 by Addison-Wesley Publishing Company, Inc.
starting point
CLOSED

appl: passive open


send: <nothing>

ap sen
pl:
ac : SY
timeout

tiv
LISTEN

d
send: RST

eo
C K

pe
,A passive open

N
ap

n
SYN pl
:s
d: se en
sen T nd d
N; RS : S da
Y v: YN ta
v:S rec
rec
recv: SYN appl: close
SYN_RCVD SYN_SENT
send: SYN, ACK or timeout
simultaneous open active open
se r K
nd ecv: , AC
:< A N K
no CK SY AC
th v: nd:
in c
g> re se

appl: close recv: FIN


ESTABLISHED CLOSE_WAIT
send: FIN send: ACK
data transfer state

se
lo appl: close
:l c FIN
p send: FIN
ap nd:
se
simultaneous close
recv: FIN recv: ACK
FIN_WAIT_1 CLOSING LAST_ACK
send: ACK send: <nothing>
re
cv
: passive close
se FIN
recv: ACK nd recv: ACK
send: <nothing> : A , AC send: <nothing>
CK K

recv: FIN
FIN_WAIT_2 TIME_WAIT
send: ACK
2MSL timeout
active close

normal transitions for client


normal transitions for server
appl: state transitions taken when application issues operation
recv: state transitions taken when segment received
send: what is sent for this transition

TCP state transition diagram.

Reprinted from TCP/IP Illustrated, Volume 2: The Implementation


by Gary R. Wright and W. Richard Stevens,
Copyright © 1995 by Addison-Wesley Publishing Company, Inc.

You might also like