Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Please refer to Fig. 1, the method basic procedure schematic diagram of the terminal request downloaded resources that the embodiment of the invention one provides mainly comprises:
S101, to broadcast domain broadcasting consulting message, whether this consulting message is downloaded or the described file of request download from file server for the other-end in the described broadcast domain of consulting.
The executive agent of the method for the terminal request downloaded resources that the embodiment of the invention one provides can be a kind of terminal.In embodiments of the present invention, some terminals are connected with gateway, gateway arrives file transfer protocol (FTP) (FTP by network connection again, File Transfer Protocol) or HTML (Hypertext Markup Language) (HTTP, HyperText Transfer Protocol) file server such as, gateway, some terminals and connection thereof have just constituted a broadcast domain, and any one terminal is to broadcast domain broadcasting consulting message in the broadcast domain, and the response message of message can be received and be seeked advice to this terminal transmission to other-end.For example, terminal T1 is to a consulting of broadcast domain broadcasting message, and the other-end in the broadcast domain at terminal T1 place can be received this consulting message.
S102 receives the response message of seeking advice from message, and the situation of downloading file from file server according to other-end in the described broadcast domain of this response message reflection determines whether to be connected to file server download file.
As previously mentioned, after any one terminal sent consulting message in the broadcast domain, other-end was the response message that can receive and send to this terminal this consulting message.For example, current terminal T
1Send file is downloaded in a request from file server consulting message D to broadcast domain
m, another terminal T in the broadcast domain
2Receive this consulting message D
mIf terminal T
2Just in the execute file downloading task, then at consulting message D
mSend a response message ACK1(D
m): just in download message, with to current terminal T
1Show terminal T
2The present situation be " publish papers up and down from file server to part "; If terminal T
2Sent a request to broadcast domain and downloaded the consulting message of file from file server, just the replying of pending file server, then at sending consulting message D
mA response message ACK2(D
m): asking download message, with to current terminal T
1Show terminal T
2The present situation be " asking publish papers up and down from file server to part ".
In embodiments of the present invention, also have a kind of situation to be: as current terminal T
1Send file is downloaded in a request from file server consulting message D to broadcast domain
mThe time, terminal T
2Receive consulting message D
m, but terminal T
2Both do not had the execute file downloading task, do not sent the consulting message and just the replying of pending file server to broadcast domain yet, this moment terminal T
2Do not do any replying.But after a period of time, terminal T
2Request is downloaded file from file server, at this moment terminal T
2Also can send the message of " asking download message " to broadcast domain, to show terminal T
2The present situation be " asking publish papers up and down from file server to part ".Obviously, current terminal T
1When receiving above-mentioned message, although this message is not consulting message D
mResponse message, but still can know terminal T
2" asking publish papers up and down from file server to part ".
The embodiment of the invention is by learning the download of terminal in the described broadcast domain, when terminal be connected to file server and can not impact to server transfer to terminal and determine, not only to the accuracy height of the control of when asking to download, the impact that farthest reduces or file server is caused when avoiding a plurality of terminals to initiate download request simultaneously to file server simultaneously, and the method that the embodiment of the invention provides can be supported multiple external server.
Please refer to Fig. 2, the method basic procedure schematic diagram of the terminal request downloaded resources that the embodiment of the invention two provides mainly comprises step:
S201, to broadcast domain broadcasting consulting message, this consulting message is used for file is being downloaded in consulting from file server terminal quantity.
S202 receives the response message of seeking advice from message, adds up the terminal quantity of downloading file in the described broadcast domain from file server according to response message.
After any one terminal sent consulting message in the broadcast domain, other-end was the response message that can receive and send to this terminal this consulting message.For example, current terminal T
1Send file is downloaded in a request from file server consulting message D to broadcast domain
m, another terminal T in the broadcast domain
2Receive this consulting message D
mIf terminal T
2Just in the execute file downloading task, then at sending consulting message D
mA response message ACK1(D
m): just in download message, with to current terminal T
1Show terminal T
2The present situation be " publish papers up and down from file server to part "; If terminal T
2Sent a request to broadcast domain and downloaded the consulting message of file from file server, just the replying of pending file server, then at sending consulting message D
mA response message ACK2(D
m): asking download message, with to current terminal T
1Show terminal T
2The present situation be " asking publish papers up and down from file server to part ".
In embodiments of the present invention, also have a kind of situation to be: as current terminal T
1Send file is downloaded in a request from file server consulting message D to broadcast domain
mThe time, terminal T
2Receive consulting message D
m, but terminal T
2Both do not had the execute file downloading task, do not sent the consulting message and just the replying of pending file server to broadcast domain yet, this moment terminal T
2Do not do any replying.But after a period of time, terminal T
2Request is downloaded file from file server, at this moment terminal T
2Also can send the message of " asking download message " to broadcast domain, to show terminal T
2The present situation be " asking publish papers up and down from file server to part ".Obviously, current terminal T
1When receiving above-mentioned message, although this message is not consulting message D
mResponse message, but still can know terminal T
2" asking publish papers up and down from file server to part "
Current terminal T
1Receive consulting message D
mResponse message after, just can add up the terminal quantity T that is downloading in the described broadcast domain according to response message
D, for example, current terminal T
1Receive the response message of 10 " just in download message " and so on, then current terminal T
1Adding up the terminal quantity of downloading in the described broadcast domain is 10.
S203, the terminal quantity T that is downloading in the more described broadcast domain
DWith the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tSize.
Allow the maximum terminal quantity M from the concurrent download of file server in the broadcast domain
tCan be issued to each terminal in the broadcast domain then by in the server end configuration, comprise current terminal T
1
If S204 is the terminal quantity T that is downloading in the described broadcast domain
DGreater than the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
t, current terminal T then
1Abandon being connected to file server and download file.
This be because, the terminal quantity T that is downloading in the described broadcast domain
DGreater than the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tThe time, show that then being connected to file server downloads the terminal quantity of file and reached the limit terminal quantity that it can concurrent download, can not or be not suitable for accepting the download request of other-end, current terminal T again
1Should abandon being connected to file server and download file.
If S205 is the terminal quantity T that is downloading in the described broadcast domain
DLess than the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
t, then current terminal is according to the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tWith the terminal quantity T that is downloading in the described broadcast domain
DDifference judgement whether be connected to file server and download file.
If the terminal quantity T that is downloading in the described broadcast domain
DLess than the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
t, then show current terminal T
1Also may be connected to file server and download file.In these cases, in embodiments of the present invention, current terminal T
1Be can be according to the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tWith the terminal quantity T that is downloading in the described broadcast domain
DCha Zhi ⊿ MT(=M
t-T
D) whether judgement is connected to file server downloads file.
For example, at above-mentioned Cha Zhi ⊿ MT, current terminal T
1A kind of judgement whether be connected to file server and download document method as shown in Figure 3, comprise step:
S301 adds up the terminal quantity T that downloads file in the described broadcast domain from file server requests according to response message
R
According to the quantity of this class message of " asking download message " in the response message, add up the terminal of asking in the described broadcast domain to download and (comprise current terminal T
1) quantity T
RFor example, current terminal T
1Receive the response message of 15 " asking download message " and so on, then current terminal T
1Adding up the terminal quantity of asking in the described broadcast domain to download is 15.
If S302 is the above-mentioned terminal quantity T that downloads of asking
RBe less than or equal to the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tWith the terminal quantity T that is downloading in the described broadcast domain
DCha Zhi ⊿ MT, current terminal T then
1Determine to be connected to file server and download file.
If the above-mentioned terminal quantity T that downloads of asking
RBe less than or equal to the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tWith the terminal quantity T that is downloading in the described broadcast domain
DCha Zhi ⊿ MT, show that then file server does not also reach the limit terminal quantity of its concurrent download, also allow terminal to be connected to file server and download file, therefore, current terminal T
1Determine to be connected to file server and download file, initiate connection request to file server.
If S303 is the above-mentioned terminal quantity T that downloads of asking
RGreater than the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tWith the terminal quantity T that is downloading in the described broadcast domain
DCha Zhi ⊿ MT, then further, to comprising current terminal T
1At this interior T
RIndividual terminal of asking to download is carried out prioritization.
In the present embodiment, to comprising current terminal T
1At this interior T
RIndividual terminal of asking to download is carried out the prioritization rule and can is: the sequence number P of prioritization
sSize according to priority increases progressively from 1.For example, the sequence number P of the terminal that priority is the highest
sBeing decided to be 1, secondly is 2, secondly is 3 again,
S304, if through after the prioritization, current terminal T
1The sequence number P of prioritization
sBe less than or equal to the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tWith the terminal quantity T that is downloading in the described broadcast domain
DCha Zhi ⊿ MT, then show current terminal T
1Still can be connected with file server, therefore, current terminal T
1Determine to be connected to file server and download file.
S305, if through after the prioritization, current terminal T
1The sequence number P of prioritization
sGreater than the maximum terminal quantity M that allows in the broadcast domain from the concurrent download of file server
tWith the terminal quantity T that is downloading in the described broadcast domain
DCha Zhi ⊿ MT, then show current terminal T
1Cannot be connected with file server, therefore, reattempt after current terminal T1 need wait for a period of time and be connected to file server download file.
In the embodiment of the invention, because current terminal has been learned the download of other-end, can decide when can be connected to file server in its sole discretion, therefore farthest avoid the impact that when a plurality of terminals are initiated download request simultaneously to file server simultaneously in the prior art file server is caused.
Be understandable that, because with respect to the other-end in the broadcast domain, terminal T for example
2, current terminal T
1Also be " other-end ", therefore, current terminal T
1Also respond the consulting message that sends from other-end, send response message to other-end, to show current terminal T to other-end
1Download file or asking to download file.
From above-described embodiment as can be known, by learning the download of terminal in the described broadcast domain, when terminal can be connected to file server transfer to the terminal decision, not only to the accuracy height of the control of when downloading, the impact that farthest reduces or file server is caused when avoiding a plurality of terminals to initiate download request simultaneously to file server simultaneously, and the method that the embodiment of the invention provides can be supported multiple external server.Simultaneously, owing to being by gateway, terminal in the embodiment of the invention and connecting and composing broadcast domain, therefore, the method that the embodiment of the invention provides can be the unit limit concurrent connection number according to subnet, thereby control the size that certain regional terminal takies the network bandwidth, be particularly suitable for the network that branch is numerous, bandwidth resources are nervous.
See also Fig. 4, a kind of terminal basic logical structure schematic diagram that the embodiment of the invention provides.For convenience of explanation, only show the part relevant with the embodiment of the invention.Functional module/unit that this terminal comprises can be module/unit that hardware module/unit, software module/unit or software and hardware combine, and the embodiment of the invention does not add restriction to this.Terminal comprises:
Sending module 41 is used for sending the consulting message to broadcast domain, and whether this other-end of seeking advice from the described broadcast domain downloads described file from file server download or request;
Download judging module 42, the response message that is used for the consulting message of reception sending module 41 transmissions, the situation of downloading file from file server according to other-end in the described broadcast domain of response message reflection determines whether to be connected to file server download file, downloads judging module 42 and comprises:
Statistic unit 421 is used for adding up the terminal quantity that described broadcast domain is being downloaded according to the response message of downloading judging module 42 receptions;
Comparing unit 422 allows from the size of the maximum terminal quantity of the concurrent download of file server in the broadcast domain that the terminal quantity that the described broadcast domain that is used for adding up comparative statistics unit 421 is being downloaded and threshold value acquisition module 43 obtain;
Processing unit 423, when being used for terminal quantity that comparing unit 422 result relatively downloading for described broadcast domain greater than the maximum terminal quantity that allows in the broadcast domain from the concurrent download of file server, current terminal abandons being connected to file server download file.
In the present embodiment, when processing unit 423 also can be used for terminal quantity that comparing unit 422 result relatively download for described broadcast domain and be less than or equal to the maximum terminal quantity that allows in the broadcast domain from the concurrent download of described file server, current terminal adjudicated whether be connected to file server download file according to the difference of the terminal quantity that allows in the broadcast domain downloading from the maximum terminal quantity of the concurrent download of file server and described broadcast domain.
So, if comparing unit 422 result relatively is less than or equal to the maximum terminal quantity that allows in the broadcast domain from the concurrent download of file server for the terminal quantity of downloading in the described broadcast domain, then processing unit 423 further comprises:
The first statistics subelement 4231 is used for adding up described broadcast domain and asking the terminal quantity downloaded according to downloading response message that judging module 42 receives;
The first judgement subelement 4233, be used for when described terminal quantity of asking to download is less than or equal to the difference that allows the terminal quantity downloaded from maximum terminal quantity and the described broadcast domain of the concurrent download of described file server in the described broadcast domain, determining to be connected to described file server download file.
As another embodiment of terminal among the present invention, as shown in Figure 5.In the present embodiment, processing unit 423 can also comprise:
The second judgement subelement 5233, be used for described when asking the difference of the terminal quantity that the terminal quantity downloaded allows in greater than described broadcast domain and downloading from maximum terminal quantity and the described broadcast domain of the concurrent download of described file server, to the terminal of asking in the described broadcast domain to download and self carry out prioritization, the sequence number Ps of described prioritization increases progressively from 1 according to the size of priority, if through after the prioritization, the sequence number Ps of the prioritization of self is less than or equal to the difference that allows the terminal quantity downloaded in the described broadcast domain from the maximum terminal quantity of the concurrent download of described file server and described broadcast domain, then determines to be connected to described file server download file.
Because in embodiments of the present invention, terminal can be connected with gateway, and gateway arrives file servers such as FTP or HTTP again by network connection, therefore gateway, some terminals and connect and compose a broadcast domain, be understandable that, with respect to the other-end in the broadcast domain, terminal T for example
2, current terminal T
1Also be " other-end ", current terminal T
1Also respond the consulting message that sends from other-end, send response message to other-end, to show current terminal T to other-end
1Download file or asking to download file.In other words, in Fig. 4 and the embodiment of the invention shown in Figure 5, terminal can also comprise receiver module 44 and respond module 43, be used for the consulting message that response sends from other-end, send response message to other-end, this response message shows that current terminal downloading file or asking to download file.
Need to prove, contents such as the information interaction between each module/unit of the said equipment, implementation since with the inventive method embodiment based on same design, particular content can repeat no more referring to the narration among the inventive method embodiment herein.
From above-described embodiment as can be known, by learning the download of terminal in the described broadcast domain, when terminal can be connected to file server transfer to the terminal decision, not only to the accuracy height of the control of when downloading, the impact that farthest reduces or file server is caused when avoiding that a plurality of terminals are initiated download request simultaneously to file server simultaneously in the prior art, and embodiment provided by the invention can support multiple external server.Simultaneously, because terminal is connected with gateway in the embodiment of the invention, constitute broadcast domain, therefore, after terminal in the embodiment of the invention and gateway connect and compose broadcast domain, can be the unit limit concurrent connection number according to subnet, thereby control the size that certain regional terminal takies the network bandwidth, be particularly suitable for the network that branch is numerous, bandwidth resources are nervous.
One of ordinary skill in the art will appreciate that all or part of step in the whole bag of tricks of above-described embodiment is to instruct relevant hardware to finish by program, this program can be stored in the computer-readable recording medium, storage medium can comprise: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or CD etc.
More than method and a kind of terminal of terminal request downloaded resources that the embodiment of the invention is provided be described in detail, used specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.