Home > Software engineering >  Consult TCP send () function and lower TCP segment section to the IP datagram grouping
Consult TCP send () function and lower TCP segment section to the IP datagram grouping

Time:09-18

Ask a question, to consider IPV4 environment in Ethernet, TCP send larger data when the send () function and the lower TCP segment section and IP datagram grouping problem,
1, should be to send larger data, application code is, how do you send the structure of the? This structure is the following?
 do 
{
(1) Read to send data to the buff (SZ) in the
(2.1) if there is to improve the data
Send (fd_tcp, buff, SZ)
(2.2) if you don't have to send data
Exit the loop
} the while (1);


2, the send () function to send data and TCP segment section and IP datagram grouping is what kind of relationship?
Read the "UNP" and some online articles, has carried on the arrangement, some questions not sure, so I ask:

His finishing TCP packet to send send function and lower agreement section grouping relationship


Sort:
(1) the send in the application (fd_tcp, buff, SZ) function to send data, then the buff (SZ) definition, the Internet has said 1 k to 10 k, such as the size seems to be associated with the socket buffer size setting of set? Also need to set up such as operating system configuration file?
(2) the send (fd_tcp, buff, SZ) after the call is successful, the data to the socket buffer, after processed by the operating system,

(3) in the socket buffer data, will be the operating system into multiple TCP segment to send (TCP1...... TCPn), specific will be divided into many segments, each message paragraph how many bytes, affected by several aspects, don't know understand it right?
(3.1) receiving comprised of TCP protocol "notification window", will tell the sender and it can receive much data, also is the socket buffer size free at the receiving end,
(3.2) receiver in the TCP MSS field tells the sender its restructuring buffer actual size, avoid fragmentation, usually MSS is 1460 bytes=MTU - IP header - TCP header,
(3.3) so each TCP segment size=TCP is less than or equal to MSS data block or first + 536 bytes (IPV4 minimum restructuring buffer 576-20 IP header - 20 TCP header) (" UNP ch2.11)
(3.4) is a TCP segment with the most business data is only 1460 bytes?
The first TCP1 ~ (3.5) TCP (n - 1) section size is 536 bytes to 1460 bytes? The size of a TCP segment in the end?

(4) a TCP segment (such as TCP1) can be divided into multiple IP datagram, isn't it?
(5) an IP datagram (IP1, for example), if the length is greater than the MTU of link layer is divided into multiple link frame, so, the book that introduces,

(6) don't understand, the length of an IP datagram is 576 ~ 65535, a TCP segment section of MSS is influenced by the link layer frames long, so the biggest MSS is only 1460, that is actually a TCP segment is in an IP datagram is sent out, do not need to split into multiple IP datagram?

CodePudding user response:

The send is in user mode, completing a copy into the kernel configuration, and return to user mode
How do you send doesn't have anything to do with the lower TCP/IP stack, you as a multithreaded black box, no matter how you call the send, send a byte, or send data over the socket buffer,
Finally how to send is the realization of TCP/IP stack to complete, has nothing to do with you
And the realization of TCP/IP stack, different operating systems are different, so you also not sure
Because this final depend on the realization of the driver




CodePudding user response:

reference 1st floor danscort2000 response:
send is in user mode, into the kernel configuration completed copy, and then return to user mode
How do you send doesn't have anything to do with the lower TCP/IP stack, you as a multithreaded black box, no matter how you call the send, send a byte, or send data over the socket buffer,
Finally how to send is the realization of TCP/IP stack to complete, has nothing to do with you
And the realization of TCP/IP stack, different operating systems are different, so you also not sure
Because this final depend on the realization of the driver

Thank you for your reply,
Operating system, no need to worry about how to do it is, however, see online articles, also feel, send this size is to have cultured,

CodePudding user response:

The whole more than 8 k bytes, WIN10, throughout the 200 KB, speed is good, the specific circumstances, specific debugged,
  • Related