how to verify tcp checksum

view full story

http://stackoverflow.com – For some odd reason, i'm unable to properly verify the TCP checksum. I have code to check IP and UDP checksum, and it works perfectly fine, but for TCP something in my logic is amiss. My struct definitions for these headers are fine as i can read the data perfectly fine (verified from wireshark). The only problem i'm having is that for TCP checksum, i'm unable to verify whether the checksum is actually correct. Any thoughts as to where i'm doing this wrong? Very much appreciated. unsigned short in_cksum(unsigned short *addr,int len) { register int sum = 0; u_short answer = 0; (HowTos)