Current location - Quotes Website - Team slogan - The first four bytes of the tcp header are 0d 28 00 15. What is the port number? How to calculate?
The first four bytes of the tcp header are 0d 28 00 15. What is the port number? How to calculate?
As shown in the figure, the TCP header is ***20 bytes, and the option (if any) is 4 bytes. The prototype definitions of headers and options are as follows: /*TCP header definition, * * 20 bytes */typedefstruct _ TCP _ header {short m _ source port; //Source port number 16bit short m _ sDestPort// Destination port number 16-bit unsigned int m _ uisequenum///Serial number 32-bit unsigned int m _ uiacknowlegenum// Confirmation number 32-bit short m _ shearlenandflag//First 4 bits: TCP header length; Middle 6 digits: reserved; Last 6 bits: flag bit short m _ sWindowSize// window size16 bit short m _ s checksum; //test and16 bitshort m _ SurgentPointer; //Emergency data offset16bit} _ _ attribute _ ((packed)) TCP _ header, * PTCP _ header/* The option definition in TCP header is kind(8bit)+Length(8bit, the length of the whole option, including the first two parts) +content (if any) kind =/kl. Part 2 without the back indicates that the length after the maximum segment is the length of the maximum segment option (in bytes, 1+ 1+ content part length) 3 indicates that the length after windows scale is the length of windows scale option (in bytes,1+/kloc-0+content part length) 4 indicates the allowable length of SACK. No content part 5 indicates that this is a SACK packet with length 2, and no content part 8 indicates a time stamp with length 10 and an 8-byte time stamp */typedefstruct _ TCP _ options {charm _ ckind; Char m _ cLengthChar m_cCo, bear muscle Cao Ke, Jiujian Xuechang mill ntext [32]; }__attribute__ ((packaging)) TCP_OPTIONS, * PTCP _ OPTIONS