CodePudding user response:
Constantly sending packages, accept packages, write filesCodePudding user response:
Ls how much contract time interval for goodCodePudding user response:
My classmates told me use winsock, but feeling do not know how to start! You did a great god feasible code for my reference, thank you very much!CodePudding user response:
With indy components, search usage yourselfCodePudding user response:
The WINSOCK implementation you use a HTTP protocol network file receiving procedures, and on the Internet to download a large file, through the received per second file data can know how much is speed, speed measurement should be closed when other occupy network software, can improve the accuracy,Don't use WINSOCK, TCP components can also use CB or INDY TCP component for development, also realize the HTTP protocol, you can achieve the same result,
Pseudo code:
Clock_t start_clock=clock ();//get the clock (unit: ms)
Len=recv (sock, buffer, 256, 0);//receive bytes
Clock_t end_clock=clock ();//get the clock (unit: ms)
Clock_t diff_time=(end_clock - start_clock)/CLOCKS_PER_SEC;//the clock difference (unit: second)
Int speed=len/diff_time;//speed (number of bytes per second)
CodePudding user response:
If there is any feasible TCP code, thank you,,,