A non-transitory computer-readable storage medium storing a computer program for causing a computer to execute a communication method, the method comprising:
- obtaining information of a window size from a communication partner apparatus;
- deciding, based on the obtained information of the window size, a data size of transmitting data to the communication partner apparatus;
- calculating a checksum of data to be transmitted to the communication partner apparatus in a case where a predetermined condition is satisfied;
- generating common header information which is common to a plurality of packets to be transmitted to the communication partner apparatus and generating, by a first method, the headers for the packets to be transmitted to the communication partner apparatus using the generated common header information in a case where the decided data size exceeds a predetermined size,
- wherein in a case where a checksum of data to be transmitted to the communication partner apparatus has been already calculated, the headers are generated by using the checksum, and
- wherein in a case where a checksum of data to be transmitted to the communication partner apparatus has not been calculated, a checksum of data to be transmitted to the communication partner apparatus is calculated and the headers are generated by using the checksum;
- and
- generating, by a second method different from the first method, a header for a packet to be transmitted to the communication partner apparatus without generating the common header information in a case where the decided data size does not exceed the predetermined size.