Reply To: Modify packet [DELPHI]

Home Forums Discussions Support Portal Modify packet [DELPHI] Reply To: Modify packet [DELPHI]

#5577

heilong
Participant

Checksum = calculate (pointer, (header+data) div 2), as for ICMP as TCP

Example:


Packet = ETH_HDR+IP_HDR+TCP_HDR+Data;
IP_HDR.Checksum := 00;
IP_HDR.Checksum := htons(Checksum(Pword(IP_HDR), sizeof(IP_HDR) div 2));

TCP.Checksum := 00;
TCP_HDR.Checksum := htons(Checksum(Pword(TCP_HDR), sizeof((TCP_HDR+Length(Data)) div 2));

For more: See ICMP example in previous reply