Embodiment
The embodiment of the present invention provides a kind of batch terminal upgrading method and device, for realizing the batch upgrade of terminal, improves upgrading efficiency.
For making goal of the invention of the present invention, feature, advantage can be more obvious and understandable, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, the embodiments described below are only the present invention's part embodiment, but not whole embodiment.Embodiment based in the present invention, the every other embodiment that those skilled in the art obtains, belongs to the scope of protection of the invention.
Embodiment mono-
The batch terminal upgrading method that the embodiment of the present invention provides, comprising: for the different virtual network interface card from each terminal communication distributes different IP addresses; The upgrading data packet that needs are sent is bound with each Microsoft Loopback Adapter respectively, or, to the terminal of communicating by letter with each Microsoft Loopback Adapter, send respectively and safeguard the modification order of IP address, make each terminal that preset IP address is revised as respectively in the IP address of safeguarding separately, wherein, the preset IP address after each terminal modifications is not identical; The IP addresses different by each Microsoft Loopback Adapter send to upgrading data packet each terminal simultaneously, so that each terminal can complete upgrading after receiving upgrading data packet.
Referring to Fig. 1, concrete steps can comprise:
101, for to distribute different IP addresses from the different virtual network interface card of each terminal communication;
In order to improve upgrading efficiency,, when a plurality of terminals are inserted after PC simultaneously, can there is in PC side the Microsoft Loopback Adapter of respective number in a plurality of terminals of need to upgrading on a PC in actual applications.According to prior art, by terminal, be the IP address conflict problem that a plurality of Microsoft Loopback Adapters may be caused in Microsoft Loopback Adapter distributing IP address, for example each terminal is that corresponding with it Microsoft Loopback Adapter has distributed same IP address.In embodiments of the present invention, terminal batch upgrading device is that a plurality of Microsoft Loopback Adapters on PC distribute different IP addresses, and to avoid the afoul problem in IP address, the present invention will provide detailed description in subsequent embodiment.
102, upgrading data packet needs being sent is bound with each Microsoft Loopback Adapter respectively, or, to the terminal of communicating by letter with each Microsoft Loopback Adapter, send respectively and safeguard the modification order of IP address, make each terminal that preset IP address is revised as respectively in the IP address of safeguarding separately, the preset IP address after each terminal modifications is not identical;
In embodiments of the present invention, by upgrading data packet is safeguarded to the modification order of IP address with each Microsoft Loopback Adapter binding or transmission respectively, wherein, safeguard that it is preset IP address that the respectively unduplicated IP address identical with terminal number selected in the modification order meeting of IP address from address pool, so that each terminal is revised as preset IP address by IP address separately respectively, by these two kinds of mode terminal batch upgrading devices, set up the approach of a plurality of Microsoft Loopback Adapters and terminal One-to-one communication simultaneously, to reach the object that sends upgrading data packet simultaneously, realize the batch upgrade of terminal, improve upgrading efficiency.
103, by the different IP address of each Microsoft Loopback Adapter, upgrading data packet is sent to each terminal simultaneously.
After solving Microsoft Loopback Adapter IP address conflict problem, by by the binding of upgrading data packet and each Microsoft Loopback Adapter or send and safeguard that IP address revises after order, terminal batch upgrading device can send upgrading data packet by the different IP addresses of each Microsoft Loopback Adapter simultaneously, each terminal just can complete upgrading after receiving upgrading data packet, realize terminal batch upgrading, improve upgrading efficiency.
In embodiments of the present invention, due to what distribute for each Microsoft Loopback Adapter, it is different IP addresses, can avoid the problem of IP address conflict between each Microsoft Loopback Adapter, after distributing IP address for each Microsoft Loopback Adapter, the upgrading data packet that needs are sent is bound or is sent from each Microsoft Loopback Adapter respectively and safeguards that it is different preset IP addresses that the modification order of IP address makes each terminal modifications, by these two kinds of modes, set up the approach of a plurality of Microsoft Loopback Adapters and terminal One-to-one communication simultaneously, then by the different IP address of each Microsoft Loopback Adapter, upgrade data is sent to each terminal simultaneously, the object of realization to terminal batch upgrading, improved upgrading efficiency.
With a detailed embodiment, introduce the batch terminal upgrading method of the embodiment of the present invention below, refer to embodiment bis-.
Embodiment bis-
The batch terminal upgrading method that the embodiment of the present invention provides, refer to Fig. 2, concrete steps can comprise: the DHCP 201, configuring by operating system is embodied as each Microsoft Loopback Adapter distributing IP address, until the IP address of each Microsoft Loopback Adapter is finished assigning process when different;
In embodiments of the present invention, a plurality of terminals of upgrading on a PC, when a plurality of terminals are inserted after PC simultaneously, can there is in PC side the Microsoft Loopback Adapter of respective number, communication link between Microsoft Loopback Adapter and terminal is established, the DynamicHost that terminal batch upgrading device configures by operating system arranges agreement (DHCP, Dynamic Host Configuration Protocol) be embodied as each Microsoft Loopback Adapter distributing IP address, first by a Microsoft Loopback Adapter, initiate DHCP request message, with that terminal request distributing IP address to communicating by letter with Microsoft Loopback Adapter, terminal is after receiving DHCP request message, can in secondary IP address pond, choose at random an IP address, for example from address pool 192.168.0.2~192.168.0.254, choose at random an IP address 192.168.0.6, then can send to terminal batch upgrading device by DHCP offer message, whether the IP address that then judgement receives is identical with the IP address of distributing to other Microsoft Loopback Adapter, if not, by the IP address assignment receiving, give this Microsoft Loopback Adapter, if so, send DHCP Decline message and inform that this IP address of terminal is assigned with, have conflict, again initiate DHCP request message, until distribute to the IP address of this Microsoft Loopback Adapter, do not conflict with the IP address of distributing to other Microsoft Loopback Adapter.According to the strategy of above-mentioned distributing IP address, to all Microsoft Loopback Adapter distributing IP addresses, when distributing behind IP address to all Microsoft Loopback Adapters, finish assigning process.
In embodiments of the present invention, suppose that the terminal number that a PC upgrades is simultaneously less than 16, and available IP number of addresses there are 253, so distribute an address conflict probability conventionally in 6%, if and after conflict, can again initiate IP and obtain request, therefore can settling IP address conflict problem.
202, upgrading data packet needs being sent is bound with each Microsoft Loopback Adapter respectively;
For example, because the common IP address of safeguarding of terminal is (being all 192.168.0.1) of acquiescence, according to the way of prior art, because destination address is all 192.168.0.1, can from routing table, choose first suitable route forwards, by IP layer, sending upgrading data packet can only send from one of them Microsoft Loopback Adapter, only have the terminal of communicating by letter with this Microsoft Loopback Adapter can receive upgrading data packet, cause other terminal can not receive upgrading data packet, in embodiments of the present invention, terminal batch upgrading device is realized by the bonding network card technique in network service, for example, step 201 has solved after the IP address conflict problem of each Microsoft Loopback Adapter, suppose Microsoft Loopback Adapter 1, Microsoft Loopback Adapter 2, the IP address of Microsoft Loopback Adapter 3 is respectively 192.168.1.15, 192.168.1.56, 192.168.1.126, in terminal batch upgrading device, first create 3 IPEndPoint objects, for example, for Microsoft Loopback Adapter 1, create a following object:
IPEndPoint?po1=new?IPEndPoint(IPAddress.Parse(″192.168.1.15″),8084);
// wherein, port is arbitrarily specified, as long as do not conflict with other IPEndPoint;
Socket?mySocket1=new?Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
mySocket1.Bind(po1);
So far, the upgrading data packet by mySocket1 and the IP of Microsoft Loopback Adapter 1 address binding to together with, terminal batch upgrading device can send upgrading data packet in the terminal of Microsoft Loopback Adapter 1 correspondence by mySocket1.The same operation of other Microsoft Loopback Adapter, the upgrading data packet that terminal batch upgrading device sends needs is thus bound with each Microsoft Loopback Adapter respectively, to set up the approach of a plurality of Microsoft Loopback Adapters and terminal One-to-one communication simultaneously.
It should be noted that, in embodiments of the present invention, 202 can also be replaced by following steps:
To the terminal of communicating by letter with each Microsoft Loopback Adapter, send respectively and safeguard the modification order of IP address, make each terminal that preset IP address is revised as respectively in the IP address of safeguarding separately, the preset IP address after each terminal modifications is not identical;
In practical application scene, the terminal batch upgrading device of take is provided with n Microsoft Loopback Adapter and describes as example, first terminal batch upgrading device (supposes that IP address is: 192.168.0.2) to terminal 1, send one and safeguard the modification order of IP address by Microsoft Loopback Adapter 1, terminal 1 is revised and safeguarded that IP address (as: 192.168.0.1) is another preset IP address (for example selecting IP address from address pool is that 192.168.0.100 is as preset IP address), in the routing table of PC, increase a route, order can be as example below simultaneously:
Route?add?192.168.0.100?mask?255.255.255.255192.168.0.2
That is, if send the Microsoft Loopback Adapter 1 that upgrading data packet is just 192.168.0.2 from address to 192.168.0.100 and send out.
When by terminal 1 safeguard that IP address has been revised after, according to identical method, different preset IP addresses is revised as respectively in the IP address of safeguarding of a remaining n-1 terminal, and increases route with explanation in routing table.
203, the terminal of safeguarding IP address by the different IP address of each Microsoft Loopback Adapter to each sends upgrading data packet simultaneously.
In embodiments of the present invention, owing to having set up the man-to-man avenues of communication of Microsoft Loopback Adapter and terminal by network card binding, therefore when terminal batch upgrading device safeguards that to each terminal of IP address sends upgrading data packet simultaneously by the different IP addresses of each Microsoft Loopback Adapter respectively, can guarantee that each terminal can receive upgrading data packet, each terminal can complete upgrading after receiving upgrading data packet.For example, the interface providing by WinPcap, by searching each Microsoft Loopback Adapter and sending upgrading data packet by each Microsoft Loopback Adapter, in actual applications, can send individual data bag by pcap_sendpacket () function, also can send one group of packet by Send queues.
In embodiments of the present invention, because the DHCP configuring by operating system is embodied as each Microsoft Loopback Adapter distributing IP address, therefore can avoid the problem of IP address conflict between each Microsoft Loopback Adapter, after distributing IP address for each Microsoft Loopback Adapter, the upgrading data packet that needs are sent is bound with each Microsoft Loopback Adapter respectively, to set up the approach of the One-to-one communication of a plurality of Microsoft Loopback Adapters and terminal simultaneously, then the terminal of safeguarding IP address to each sends upgrading data packet, the object of realization to terminal batch upgrading, has improved upgrading efficiency.
With another detailed embodiment, introduce the batch terminal upgrading method of the embodiment of the present invention below, refer to embodiment tri-.
Embodiment tri-
The batch terminal upgrading method that the embodiment of the present invention provides, refers to Fig. 3, and concrete steps can comprise: 301, each Microsoft Loopback Adapter is given in the mutually different IP of static allocation address;
In embodiments of the present invention, the mode that terminal batch upgrading device can also adopt static allocation IP address is each different Microsoft Loopback Adapter distributing IP address.For example, when a plurality of terminals are inserted after PC simultaneously, can there is in PC side the Microsoft Loopback Adapter of respective number, terminal batch upgrading device can, for all Microsoft Loopback Adapter static allocation IP addresses, be chosen different fixed ip address and distribute to each Microsoft Loopback Adapter from address pool (as 192.168.0.2~192.168.0.254).
302, to the terminal of communicating by letter with each Microsoft Loopback Adapter, send respectively and safeguard the modification order of IP address, make each terminal that preset IP address is revised as respectively in the IP address of safeguarding separately, the preset IP address after each terminal modifications is not identical;
In practical application scene, the terminal batch upgrading device of take is provided with n Microsoft Loopback Adapter and describes as example, first terminal batch upgrading device (supposes that IP address is: 192.168.0.2) to terminal 1, send one and safeguard the modification order of IP address by Microsoft Loopback Adapter 1, terminal 1 is revised and safeguarded that IP address (as: 192.168.0.1) is another preset IP address (for example selecting IP address from address pool is that 192.168.0.100 is as preset IP address), in the routing table of PC, increase a route, order as follows simultaneously:
Route?add?192.168.0.100?mask?255.255.255.255192.168.0.2
That is, if send the Microsoft Loopback Adapter 1 that upgrading data packet is just 192.168.0.2 from address to 192.168.0.100 and send out.
When by terminal 1 safeguard that IP address has been revised after, according to identical method, different preset IP addresses is revised as respectively in the IP address of safeguarding of a remaining n-1 terminal, and increases route with explanation in routing table.
It should be noted that, in embodiments of the present invention, 302 can also be replaced by following steps:
Terminal batch upgrading device is realized by the bonding network card technique in network service, 301 have solved after the IP address conflict problem of each Microsoft Loopback Adapter, suppose that the IP address of Microsoft Loopback Adapter 1, Microsoft Loopback Adapter 2, Microsoft Loopback Adapter 3 is respectively 192.168.1.15,192.168.1.56,192.168.1.126; In terminal batch upgrading device, first create 3 IPEndPoint objects, for example, for Microsoft Loopback Adapter 1, create a following object:
IPEndPoint?po1=new?IPEndPoint(IPAddress.Parse(″192.168.1.15″),8084);
// wherein, port is arbitrarily specified, as long as do not conflict with other IPEndPoint;
Socket?mySocket1=new?Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
mySocket1.Bind(po1);
So far, the upgrading data packet by mySocket1 and the IP of Microsoft Loopback Adapter 1 address binding to together with, terminal batch upgrading device can send upgrading data packet in the terminal of Microsoft Loopback Adapter 1 correspondence by mySocket1.The same operation of other Microsoft Loopback Adapter, the upgrading data packet that terminal batch upgrading device sends needs is thus bound with each Microsoft Loopback Adapter respectively, to set up the approach of a plurality of Microsoft Loopback Adapters and terminal One-to-one communication simultaneously.
303, by the different IP address of each Microsoft Loopback Adapter, to each terminal, send upgrading data packet simultaneously.
In embodiments of the present invention, because different IP addresses has been revised as in the IP address of safeguarding of the terminal of communicating by letter from each Microsoft Loopback Adapter, therefore when terminal batch upgrading device is when the different IP addresses by each Microsoft Loopback Adapter sends upgrading data packet to each terminal respectively simultaneously, can guarantee that each terminal can receive upgrading data packet, each terminal can complete upgrading after receiving upgrading data packet.
In embodiments of the present invention, the mode that adopts static allocation IP address due to terminal batch upgrading device is distributed different fixed ip address for each virtual terminal, therefore can avoid the problem of IP address conflict between each Microsoft Loopback Adapter, when being after a Microsoft Loopback Adapter distributes IP address, by transmission, safeguard that the modification order of IP address makes the IP address of safeguarding of each terminal be revised as different preset IP addresses, then the different IP address of safeguarding to each terminal sends upgrading data packet, realize the object to terminal batch upgrading, improved upgrading efficiency.
In actual applications, the terminal batch upgrading device that the embodiment of the present invention provides specifically can be built in PC, by the integrated mode of software and hardware, realizes the processing to terminal batch upgrading.To introduce and the corresponding device of method of introducing in said method embodiment in embodiments of the present invention, specifically the manner of execution of each unit can be referring to said method embodiment, and the content of only describing correlation unit at this, is described as follows.
Embodiment tetra-
The terminal batch upgrading device that the embodiment of the present invention provides, comprising: IP address assignment unit, binding unit or modification command sending unit, Packet Generation unit.
Refer to Fig. 4-a and Fig. 4-b, terminal batch upgrading device 400, comprising: IP address assignment unit 401, and binding unit 402 or modification command sending unit 403, Packet Generation unit 404, wherein,
IP address assignment unit 401, is used to from the different virtual network interface card of each terminal communication and distributes different IP addresses;
In actual applications, a kind of concrete implementation is that IP address assignment unit 401 can comprise: (not shown in Figure 4)
DHCP distribution module, is embodied as each Microsoft Loopback Adapter distributing IP address for the DHCP configuring by operating system, until the IP address of each Microsoft Loopback Adapter is finished assigning process when different.
Manner of execution between each module can, referring to embodiment bis-, repeat no more herein.
Under another kind of application scenarios, IP address assignment unit 401 can comprise: (not shown in Figure 4)
Static allocation module, gives each Microsoft Loopback Adapter for the mutually different IP of static allocation address.Wherein, a kind of attainable mode is that static allocation module specifically for selecting with the same number of mutual unduplicated IP address assignment of Microsoft Loopback Adapter to each Microsoft Loopback Adapter from address pool.The concrete manner of execution of this module can repeat no more referring to embodiment tri-herein,
Binding unit 402, binds with each Microsoft Loopback Adapter respectively for the upgrading data packet that needs are sent;
Or, revise command sending unit 403, for sending respectively to the terminal of communicating by letter with each Microsoft Loopback Adapter, safeguard the modification order of IP address, make each terminal that preset IP address is revised as respectively in the IP address of safeguarding separately, the preset IP address after each terminal modifications is not identical;
In actual applications, binding unit 402 can comprise: (not shown in Figure 4)
Object Creation module, creates the not identical object of port numbers for being respectively each Microsoft Loopback Adapter;
Binding module, for packet that needs are sent respectively with the object binding creating.
The concrete manner of execution of Object Creation module and binding module can, referring to embodiment bis-, repeat no more herein.
Packet Generation unit 404, for upgrading data packet is sent to each terminal by the different IP address of each Microsoft Loopback Adapter simultaneously, so that each terminal can complete upgrading after receiving upgrading data packet.
In embodiments of the present invention, due to what distribute for each Microsoft Loopback Adapter, it is different IP addresses, can avoid the problem of IP address conflict between each Microsoft Loopback Adapter, after distributing IP address for each Microsoft Loopback Adapter, the upgrading data packet that needs are sent is bound with each Microsoft Loopback Adapter respectively, or, transmission safeguards that it is different preset IP addresses that the modification order of IP address makes each terminal modifications, by these two kinds of modes, set up the approach of a plurality of Microsoft Loopback Adapters and terminal One-to-one communication simultaneously, then by the different IP address of each Microsoft Loopback Adapter, upgrade data is sent to each terminal simultaneously, the object of realization to terminal batch upgrading, improved upgrading efficiency.
With an actual application scenarios, introduce the terminal batch upgrading device in the embodiment of the present invention below, in a PC, by the mode of hardware and software, be integrated with the terminal batch upgrading device of the embodiment of the present invention, PC side includes a plurality of USB interface, for example 6, when there being 6 terminals to be inserted into after PC by USB, can go out corresponding 6 Microsoft Loopback Adapters in PC side, first IP address assignment unit can for 6 Microsoft Loopback Adapters distribute 6 mutually different IP addresses (be for example: 192.168.1.15, 192.168.1.56, 192.168.1.126, 192.168.1.19, 192.168.1.58), solve after the collision problem of Microsoft Loopback Adapter, the upgrading data packet that needs can be sent by binding unit (or sends respectively and safeguards the modification order of IP address to 6 terminals of communicating by letter with 6 Microsoft Loopback Adapters by revising command sending unit with 6 Microsoft Loopback Adapter bindings respectively, make 6 terminals that the IP address of safeguarding is separately revised as respectively to 6 different IP addresses and (is for example: 192.168.1.23, 192.168.1.25, 192.168.1.29, 192.168.1.30, 192.168.1.31), by any of this two kinds of modes, PC side has been set up the approach of a plurality of Microsoft Loopback Adapters and terminal One-to-one communication simultaneously, finally, Packet Generation unit, for upgrading data packet is sent to 6 terminals by 6 different IP addresses of Microsoft Loopback Adapter simultaneously, so that each terminal can complete upgrading after receiving upgrading data packet.
It should be noted that, terminal batch upgrading device in the embodiment of the present invention not only can be applied in the application scenarios of upgrading, can also be applied in other controls application and comprises that Bulk Call test (controls large batch of terminal simultaneously and carry out certain action, certain application scenarios is imitated in actions such as networking, calling, to reach the object of carrying out pressure test) etc.
One of ordinary skill in the art will appreciate that all or part of step realizing in above-described embodiment method is to come the hardware that instruction is relevant to complete by program, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium of mentioning can be read-only memory, disk or CD etc.
Above a kind of batch terminal upgrading method provided by the present invention and device are described in detail, for one of ordinary skill in the art, thought according to the embodiment of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.