How to get TcpDataLen?

Home Forums Discussions Support Portal How to get TcpDataLen?

This topic contains 0 replies, has 1 voice, and was last updated by  pompam 7 years, 11 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5275

    pompam
    Participant

    Hi, I’m trying to get the TCP data length of a TCP/IP packet, but it’s always returning 4 for me, even if the TCP data comes empty.
    Can anyone check what’s wrong with my code?


    if (ntohs(pEtherHeader.h_proto)=ETH_P_IP) then begin
    pIPHeader:=TIPHeaderPtr(Integer(pEtherHeader)+SizeOf(TEtherHeader));
    if (pIPHeader.Protocol = IPPROTO_TCP) then begin
    pTcpHeader:=TTCPHeaderPtr(Integer(pIPHeader) + (pIPHeader.VerLen and $F) * 4);
    TcpDataLen:=sizeof(TIpHeader)-sizeof(TTCPHeader);
    pTcpData:=POINTER(INTEGER(pTcpHeader)+sizeof(TTCPHeader));
    end;
    end;
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.