Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Question:
The following is a dump of a TCP header in hexadecimal format.
 
05320017 00000001 00000000 500207FF 00000000
 

a. What is the source port number?
b. What is the destination port number?
c. What is the sequence number?
d. What is the acknowledgment number?
e. What is the length of header?
f. What is the type of segment?
g. What is the window size?
Posted 8-Mar-10 4:09am
Edited 14-Jun-10 0:20am
Moak11.4K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

All the information you need is found via Google. Here[^] is just one document showing the various fields.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

TCP header itself is of 10 feilds as below and size may vary between 20 to 60bytes
 
1.Source port - 2 bytes
2.destination port - 2 bytes
3.SEQ NUM-4 bytes
4.ACK NUM- 4 bytes
5.HLEN-1 word
6.RESERVED-6bits
7.CONTROL-6bits
8.WINDOW SIZE-2 bytes
9.CHECKSUM-2 bytes
10.URGENT POINTERS-2bytes
 
here's example problem from book Forouzan
 
TCP header( in hex)=05320017 00000001 000000000 500207FF 00000000
since each hex = 4 bits , we need to first split the above hex as such
05 32 00 17 00 00 00 01 00 00 00 00 50 02 07 FF 00 00 00 00
 
source port is 2 bytes take 05 32 = 1330
next 2 bytes as destination address 00 17 == 23 (default TCP port)
next 4 bytes as sequence number 00 00 00 01 ==1
next 4 bytes as ack 00 00 00 00 == 0
next 4 bits as HLEN 5 ==5 -- this indicates number of sets of 4 bytes which makes the header lenght = 20bytes..
next 6 bits are reserved i.e.0 =0000and 2 bits from hex 0
next 6 bits are control bits = remaining 2 bits from hex 0 and 4 bits of 2
next 2 bytes indicate the window length 07 FF == 2047 bytes
Checksum 2 bytes 00 00 = 0
Urgent pointer 2bytes 00 00 =0
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Here[^] is the structure of the TCP segment header. Decipher it yourself
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

TCP header itself is of 10 feilds as below and size may vary between 20 to 60bytes

1.Source port - 2 bytes
2.destination port - 2 bytes
3.SEQ NUM-4 bytes
4.ACK NUM- 4 bytes
5.HLEN-1 word
6.RESERVED-6bits
7.CONTROL-6bits
8.WINDOW SIZE-2 bytes
9.CHECKSUM-2 bytes
10.URGENT POINTERS-2bytes

here's example problem from book Forouzan

TCP header( in hex)=05320017 00000001 000000000 500207FF 00000000
since each hex = 4 bits , we need to first split the above hex as such
05 32 00 17 00 00 00 01 00 00 00 00 50 02 07 FF 00 00 00 00

source port is 2 bytes take 05 32 = 1330
next 2 bytes as destination address 00 17 == 23 (default TCP port)
next 4 bytes as sequence number 00 00 00 01 ==1
next 4 bytes as ack 00 00 00 00 == 0
next 4 bits as HLEN 5 ==5 -- this indicates number of sets of 4 bytes which makes the header lenght = 20bytes..
next 6 bits are reserved i.e.0 =0000and 2 bits from hex 0
next 6 bits are control bits = remaining 2 bits from hex 0 and 4 bits of 2
next 2 bytes indicate the window length 07 FF == 2047 bytes
Checksum 2 bytes 00 00 = 0
Urgent pointer 2bytes 00 00 =0
  Permalink  
Comments
ThePhantomUpvoter at 21-Apr-13 16:20pm
   
How, exactly, is this any different than Solution 2 for this ancient over the hill 3 year old question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Guruprasad.K.Basavaraju 390
1 Shai Vashdi 349
2 Sergey Alexandrovich Kryukov 325
3 OriginalGriff 265
4 Peter Leow 171
0 Sergey Alexandrovich Kryukov 8,979
1 OriginalGriff 5,280
2 Peter Leow 4,010
3 Maciej Los 3,535
4 Abhinav S 3,263


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 21 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid