Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question: The following code can be used to compute the checksum of a set of 16-bit binary numbers u_short_cksum(u_short buf, int count) f register w.ong.sum=0;
Question: The following code can be used to compute the checksum of a set of 16-bit binary numbers u_short_cksum(u_short "buf, int count) f register w.ong.sum=0; while (count- sumt-"buftt if (sum & 0xFFFF0000) { sum&=0xFFFF; sum+t; return (sum&0xFFFF); (i) Provide comments for each line in the above code explaining what the line does. Why should the variables be unsigned? Why is the buf short and the sum long? Implement the code on a platform of your choice. Make necessary changes in the code to make it compatible with the compiler you would be using. Run the code to calculate both UDP checksum (from Credit Hw #2) and TCP checksum by inputting all the data needed and verify your hand calculations. Question: The following code can be used to compute the checksum of a set of 16-bit binary numbers u_short_cksum(u_short "buf, int count) f register w.ong.sum=0; while (count- sumt-"buftt if (sum & 0xFFFF0000) { sum&=0xFFFF; sum+t; return (sum&0xFFFF); (i) Provide comments for each line in the above code explaining what the line does. Why should the variables be unsigned? Why is the buf short and the sum long? Implement the code on a platform of your choice. Make necessary changes in the code to make it compatible with the compiler you would be using. Run the code to calculate both UDP checksum (from Credit Hw #2) and TCP checksum by inputting all the data needed and verify your hand calculations
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started