登录
首页 » Windows Socket编程 »  各个线程任务分配是这样实现的。在开始下载时,文件平均分成若干块进行下载。如第一个线程一开始的任务是从文件的0位置开始下载一直到72908位置处。线程1每次下载...

 各个线程任务分配是这样实现的。在开始下载时,文件平均分成若干块进行下载。如第一个线程一开始的任务是从文件的0位置开始下载一直到72908位置处。线程1每次下载...

于 2022-03-20 发布 文件大小:93.98 kB
0 275
下载积分: 2 下载次数: 1

代码说明:

 各个线程任务分配是这样实现的。在开始下载时,文件平均分成若干块进行下载。如第一个线程一开始的任务是从文件的0位置开始下载一直到72908位置处。线程1每次下载一块数据后就要调整任务,如第一次下载了20800字节的数据,那么线程1的任务将改为:20800-72908。如此下去,直到任务为72908-72908时表示线程1完成了当前的下载任务。此时,线程1就分析各个线程的任务,找出任务最为繁忙的一个线程:如线程3:14816-218724。那么线程1就自动去调整任务,拿50%的任务来再次下载。周而复始直到各个线程都完成任务。不过这里有一点需要注意:为了避免重复下载部分数据,在调整任务的时候,起始的文件便移量必须加上接受缓冲器的字节数,因为如前面所举的列子来看。线程1和线程3在平衡负载的时候,线程正在下载数据,如果所剩的数据比接受缓冲器的大小还小,线程1和线程3的部分下载数据将会重复。   在调整任务和分析任务的时候,会发现一个问题。就是读取文件数据太过频繁。于是我用了一个数据结构。在下载文件的过程中始终打开配置文件,这样速度提高了很多。在文件下载完毕后关闭文件。-various threads assignment is achieved. At the beginning of the download, the paper divided into a number of pieces of the download. As a thread of a task is to start from the position paper of 0 to start the download has 72,908 locations Department. Thread a download each one will have to adjust the data tasks, such as the first downloaded 20,800 gigabytes of data, then threaded a task will be re :20800- 72908. This situation continues until the mandate of 72908-72908 said threaded a completion of the cu

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 此Windows NT网络供应商实现了一个小样本
    This Windows NT Sample Network provider implements a small subsection of the NP interface. What it shows is how you can sample logon information when a logon is performed. This "credential sampling" is often useful for implementing unified logons with differing OS platforms. Once you gather the information in the NP, you can then communicate the credentials to another platform for verification and establishment of network resources.-Sample Windows NT Network provider im plements a small subsection of the NP interface . What it shows is how you can inform sample logon ation when a logon is performed. This "credenti al sampling "is often useful for implementing u nified logons with differing OS platforms. Onc e you gather the information in the NP, you can then communicate the credentials to competitor ther platform for verification and establishm ent of network resources.
    2022-03-17 11:39:10下载
    积分:1
  • example for windows socket UDP.
    example for windows socket UDP.
    2022-04-15 03:16:42下载
    积分:1
  • ftp文件传输源序,能进行文件下载、上传,简单实用。
    ftp文件传输源程序,能进行文件下载、上传,简单实用。-ftp file transfer source code files can be download, upload, simple and practical.
    2022-03-06 02:52:42下载
    积分:1
  • Element is a network monitoring program, to be able to monitor network traffic a...
    也是一个网络监控元程序,能够监控到网络中的流量等信息-Element is a network monitoring program, to be able to monitor network traffic and other information
    2023-03-10 13:15:04下载
    积分:1
  • 仿飞
    仿飞鸽传书DELPHI局域网通讯界面 关键字:仿 飞鸽传书 界面 来 自:原创 平 台:Win2k/XP/NT,Win2003 深浅度:初级-imitation Fei-book DELPHI LAN communications interface keyword : imitation Fei-interface from the book : original platform : Win2k/XP/NT, Win2003 DEPTH : Junior
    2022-03-06 08:19:29下载
    积分:1
  • 聊天器 通过Socket,应用单线传递参数,实现局域网聊天功能,...
    聊天器 通过Socket编程,应用单线程传递参数,实现局域网聊天功能,-Socket programming device through the chat, application single-threaded pass parameters to achieve LAN chat,
    2022-06-20 00:23:39下载
    积分:1
  • 用C++在vs2005开发的tcp远文件传输序。
    用C++在vs2005开发的tcp远程文件传输程序。-With C++ In VS2005 development tcp remote file transfer procedures.
    2022-06-21 19:51:41下载
    积分:1
  • 一个完整的IOCP类,可以直接使用,方便!
    一个完整的IOCP类,可以直接使用,方便!-A complete IOCP classes can be used directly to facilitate!
    2022-02-04 06:25:02下载
    积分:1
  • BCB 环境下WHOIS协议的实现CLA
    BCB 环境下WHOIS协议的实现CLA-BCB Environment WHOIS protocol realize CLA
    2023-08-05 20:35:03下载
    积分:1
  • 译synscan.cpp请注意,如果是ADSL用户,可能要把代码里的hp
    编译synscan.cpp请注意,如果是ADSL用户,可能要把代码里的hp->h_addr_list[0]改为hp->h_addr_list[1]才能够扫描,具体是[0]还是[1]或其它,可以先编译getallIP.cpp来获取外网IP的网卡的代号。例如编译getallIP.cpp后得到以下输出 Address [0]: 192.168.1.2 Address [1]: 218.10.14.151(公网IP) 那么想扫描外网的话就要把synscan.cpp里的hp->h_addr_list[0]改为hp->h_addr_list[1]了-Compiler synscan.cpp Please note that if it is ADSL users may need to code in the hp-
    2022-02-12 10:12:34下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载