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 5:09am
Edited 14-Jun-10 1: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 5

Source port = 1330 = 0x0532
Dest port = 0x0017
seq num = 0x00000001
ack = 0x00000000
length = 0x50
type = 0x02 look up the flag bits to see what 0x02 is
size = 0x07ff
  Permalink  
Comments
CHill(Hawkeye)60 at 17-May-14 14:41pm
   
4 years ago this might have helped. Although it would seem the other solutions were enough
SoMad at 18-May-14 2:36am
   
Yeah, OP posted Solution 2 less than 30 minutes after posting the question...
I know my comment has nothing to do with this solution, I just thought I would point it out.
 
Soren Madsen

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

  Print Answers RSS
0 OriginalGriff 250
1 George Jonsson 175
2 Jochen Arndt 150
3 Kornfeld Eliyahu Peter 149
4 PIEBALDconsult 110
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 17 May 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100