Home > other >  Look not to understand a socket, how the data from one computer to another computer?
Look not to understand a socket, how the data from one computer to another computer?

Time:11-04

Say first my understanding of the socket data transmission
1, when we call the send function, data is not real sent to another section, but is written to send buffer, the socket agreement he will decide how to take the message is sent out
2, when we call recv function, not from another computer that receives the data, but has already reached the data read from the receive buffer
3, in general, send buffer and the receive buffer is 64 k

Based on the above knowledge, I recently observed a phenomenon let I can't understand, the thing is:
1, I use the node. Js wrote an HTTP server, is used to provide the file download, to deploy on my computer A
2, I deployed a download files on B computer program for file download operation, two computers in the same local area network (LAN)
3, when B computer program has launched a 50 m size of file download request, HTTP server to download service, but this time I found that the HTTP server program has been running over, run over refers to the res. The end () has been carried out, which means that the server's work has ended, but also in B the download program on the computer runs slowly,

On these three points in the following things and understanding in the face of the socket data transmission at 3 o 'clock is conflict, HTTP is based on TCP, also known as bottom socket, the 50 M data is sent out at one end, while another section also receives, the server side to complete the download service, only received a few M B computer data, can send buffer and receive buffer together is 128 k, so that at least 40 MB of data?
Are all in the way of transmission?
A great god, please give directions

CodePudding user response:

You'd better send the main code and download it, it is possible that the code is wrong
  • Related