Newbie help. How to extract TCP header length from an IP packet - TCP-IP

This is a discussion on Newbie help. How to extract TCP header length from an IP packet - TCP-IP ; Hi all, Sorry for this basic question, but after a lot of researching I still don't know how to get TCP header length of an IP packet. Let's suppose we have this IP packet: 45000038017600007E11A52F0AC7A263CE331AB20545496700 24490E10104022D41700000000420387040043010047010045 0400000098000000 If I do ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Newbie help. How to extract TCP header length from an IP packet

  1. Newbie help. How to extract TCP header length from an IP packet

    Hi all,

    Sorry for this basic question, but after a lot of researching I still
    don't know how to get TCP header length of an IP packet. Let's suppose
    we have this IP packet:

    45000038017600007E11A52F0AC7A263CE331AB20545496700 24490E10104022D41700000000420387040043010047010045 0400000098000000

    If I do this correctly, the IP header length is 20 bytes. I get this
    value from the last four bits of the first byte.
    Once I remove the IP header, I get this:
    054549670024490E10104022D4170000000042038704004301 00470100450400000098000000

    Now, if I understand correctly, I need to look at the Data Offset
    field which is located at the bit offset 96.
    In that position I have D4 so I need to take the first 4 bits for the
    header length. The value that I get is D which
    needs to be multiplied by 32 to get the TCP header length in bits. If
    I convert it to bytes, I get 52 bytes.

    Is that really the TCP header size? It looks too big. Am I doing
    something wrong?

    Thanks



  2. Re: Newbie help. How to extract TCP header length from an IP packet

    In article <16fdc398-7e57-4dd2-b80a-5be2443f9e7f@s50g2000hsb.googlegroups.com>,
    JWhite writes:
    > Hi all,
    >
    > Sorry for this basic question, but after a lot of researching I still
    > don't know how to get TCP header length of an IP packet. Let's suppose
    > we have this IP packet:
    >
    > 45000038017600007E11A52F0AC7A263CE331AB20545496700 24490E10104022D41700000000420387040043010047010045 0400000098000000

    ^^ protocol=UDP

    >
    > If I do this correctly, the IP header length is 20 bytes. I get this
    > value from the last four bits of the first byte.
    > Once I remove the IP header, I get this:
    > 054549670024490E10104022D4170000000042038704004301 00470100450400000098000000

    ^^ UDP length field

    > Is that really the TCP header size?


    No, this is not a TCP packet.

  3. Re: Newbie help. How to extract TCP header length from an IP packet

    Dick Wesseling wrote:
    > In article <16fdc398-7e57-4dd2-b80a-5be2443f9e7f@s50g2000hsb.googlegroups.com>,
    > JWhite writes:
    >> Hi all,
    >>
    >> Sorry for this basic question, but after a lot of researching I still
    >> don't know how to get TCP header length of an IP packet. Let's suppose
    >> we have this IP packet:
    >>
    >> 45000038017600007E11A52F0AC7A263CE331AB20545496700 24490E10104022D41700000000420387040043010047010045 0400000098000000

    > ^^ protocol=UDP


    Perhaps it relates to font selection, and the way it's represented here
    in the post. The carrots appear under the "0x17".

    It's actually the 0x11 (decimal 17) that conveys the protocol as UDP:

    45000038017600007E 11 A52F

    .... rather than the 0x17

    450000380 17 6000

    .... but the observation was certainly valid.

    >
    >> If I do this correctly, the IP header length is 20 bytes. I get this
    >> value from the last four bits of the first byte.
    >> Once I remove the IP header, I get this:
    >> 054549670024490E10104022D4170000000042038704004301 00470100450400000098000000

    > ^^ UDP length field
    >
    >> Is that really the TCP header size?

    >
    > No, this is not a TCP packet.



    Best Regards,
    News Reader

  4. Re: Newbie help. How to extract TCP header length from an IP packet

    Thanks a lot! I really appreciate the help from both of you.

    Regards

+ Reply to Thread