CN108073514B - Method and device for simultaneously connecting multiple mobile phone terminals by personal computer - Google Patents

Method and device for simultaneously connecting multiple mobile phone terminals by personal computer Download PDF

Info

Publication number
CN108073514B
CN108073514B CN201710586652.1A CN201710586652A CN108073514B CN 108073514 B CN108073514 B CN 108073514B CN 201710586652 A CN201710586652 A CN 201710586652A CN 108073514 B CN108073514 B CN 108073514B
Authority
CN
China
Prior art keywords
port
cur
mobile phone
ports
member variable
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710586652.1A
Other languages
Chinese (zh)
Other versions
CN108073514A (en
Inventor
郭宇
曾冰
陈丹
舒云
林秝
向伊达
宋希东
蒋寒迪
董欣明
丁波涛
惠新宇
谢虹
袁芳
刘琳
赵巡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Weein Software Technology Co ltd
Original Assignee
Beijing Weein Software Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Weein Software Technology Co ltd filed Critical Beijing Weein Software Technology Co ltd
Priority to CN201710586652.1A priority Critical patent/CN108073514B/en
Publication of CN108073514A publication Critical patent/CN108073514A/en
Application granted granted Critical
Publication of CN108073514B publication Critical patent/CN108073514B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling

Abstract

The invention relates to a method and a device for simultaneously connecting a plurality of mobile phone terminals by a personal computer, wherein the method comprises the following steps: the PC provided with the ADB driver is connected with the mobile phone terminal provided with the ADB driver through a USB; calling a port dynamic allocation function to allocate a socket connection port number to the mobile phone terminal; adjusting the mobile phone terminal to a mode allowing USB debugging; and establishing communication connection between the PC and the mobile phone terminal.

Description

Method and device for simultaneously connecting multiple mobile phone terminals by personal computer
Technical Field
The invention belongs to the field of computers, and particularly relates to a method and a device for simultaneously connecting a plurality of mobile phone terminals by a personal computer.
Background
Android debug bridge (Android Debug Bridge, abbreviated as ADB) is a means of establishing a communication connection between an Android device and a personal computer (Personal Computer, abbreviated as PC).
The working principle of ADB is: by listening to ports such as Socket TCP 5554, a communication connection is established between the electronic integrated drive (Integrated Drive Electronics, abbreviated IDE) and Qemu. By default, the ADB will daemon (daemon) on the relevant network port. Thus, when a user runs a program of a type such as Eclipse, the ADB process runs automatically.
If an Android device (e.g., a mobile phone terminal) and a personal computer are to be connected, an ADB driver is required. Specifically, if the mobile phone terminal is to be debugged and managed by a personal computer, the ADB kit needs to be installed in advance.
Currently, in the ADB underlying programs available for use, the ports allocated to the mobile phone terminals are limited due to the ABD driver itself, i.e., only 30 at most can be allocated. And, if one handset terminal needs to be operated, 2 ports are required, one of which is a transmitting port and the other of which is a receiving port. Therefore, in theory, one personal computer can operate at most 15 mobile phone terminals. Thus, the control efficiency of the personal computer on the mobile phone terminal is seriously affected, and related business requirements cannot be met.
In summary, the prior art has the defect of fixed number of port allocation of mobile phone terminals, so that the number of supported mobile phone terminals is limited to the highest degree.
The background art mentioned above is merely technical information held by the inventor for deriving the embodiments of the present invention or learned during the derivation process, and is not necessarily known to the general public prior to the submission of the embodiments of the present invention.
Disclosure of Invention
The invention aims to provide a method and a device for simultaneously connecting a plurality of mobile phone terminals by a personal computer, which are used for overcoming the defect that the personal computer cannot be simultaneously connected with a plurality of mobile phone terminals in the prior art.
In order to achieve the above object, the present invention provides a method for simultaneously connecting a plurality of mobile terminals by a personal computer, which includes: the PC provided with the ADB driver is connected with the mobile phone terminal provided with the ADB driver through a USB; calling a port dynamic allocation function to allocate a socket connection port number to the mobile phone terminal; adjusting the mobile phone terminal to a mode allowing USB debugging; and establishing communication connection between the PC and the mobile phone terminal.
The step of calling the port dynamic allocation function to allocate a socket connection port number to the mobile phone terminal may include: step 101, judging whether the fourth member variable static list ports _used is empty; step 102, when the fourth member variable static list ports _used is empty, allocating ports according to the input variable int port_num; and step 103, after the step 102 is executed, directly returning to the third member variable static int port_cur.
The step of calling the port dynamic allocation function to allocate a socket connection port number to the mobile phone terminal may further include: step 104, when the fourth member variable static list ports _used is not empty, allocating a port_cur+step port; step 105, judging whether a port_cur+step variable exists in the fourth member variable static list ports _used list; step 106, if the fourth member variable static list ports _used list has no port_cur+step variable, assigning the third member variable static int port_cur to be port_cur+step, and adding the port_cur+step to the fourth member variable static list ports _used list; and step 107, judging whether the current allocation number is smaller than the input variable int port_num, if the judgment result is that the current allocation number is smaller than the input variable int port_num, executing step 105 again, and if the judgment result is that the current allocation number is not smaller than the input variable int port_num, executing step 103.
The step of calling the port dynamic allocation function to allocate a socket connection port number to the mobile phone terminal may further include: in step 108, if the fourth member variable static list ports _used list has a port_cur+step variable, the third member variable static int port_cur is assigned as port_cur+step, and then step 104 is continued.
In order to achieve the above object, the present invention provides a device for simultaneously connecting a plurality of mobile terminals by a personal computer, which comprises: the USB connector is used for connecting the PC provided with the ADB driver and the mobile phone terminal provided with the ADB driver; the port dynamic allocation function calling module is used for allocating socket connection port numbers to the mobile phone terminals; the mobile phone terminal debugging module is used for adjusting the mobile phone terminal to a mode allowing USB debugging; and the communication connection establishment module is used for establishing communication connection between the PC and the mobile phone terminal.
The port dynamic allocation function calling module may include: a first judging unit configured to judge whether the fourth member variable static list ports _used is empty; a first allocation unit that allocates ports according to an input variable int port_num when the fourth member variable static list ports _used is empty; and a return unit that returns the third member variable static int port_cur directly after the step 102 is performed.
Wherein, the port dynamic allocation function calling module may further include: a second allocation unit configured to allocate a port_cur+step port when the fourth member variable static list ports _used is not empty; a second judging unit for judging whether a port_cur+step variable exists in the fourth member variable static list ports _used list; an assignment adding unit, configured to assign the third member variable static int port_cur to be port_cur+step and add the port_cur+step to the fourth member variable static list ports _used list if the fourth member variable static list ports _used list has no port_cur+step variable; and the second judging unit is used for judging whether the current distribution quantity is smaller than the input variable int port_num, returning to the second judging unit again if the judgment result is that the current distribution quantity is smaller than the input variable int port_num, and returning to the returning unit if the judgment result is that the current distribution quantity is not smaller than the input variable int port_num.
Wherein, the port dynamic allocation function calling module may further include: and the turning unit is used for assigning the third member variable static int port_cur to be port_cur+step if the fourth member variable static list ports _used list has a port_cur+step variable, and then returning to the second distribution unit.
According to the method for simultaneously connecting the plurality of mobile phone terminals by the personal computer, when the personal computer is simultaneously connected with the plurality of mobile phone terminals, socket connection ports are directly distributed according to the number of the connected mobile phone terminals, so that the purpose that the personal computer is simultaneously connected with the plurality of mobile phone terminals is achieved.
According to another embodiment of the present invention, when a personal computer connects a plurality of mobile terminals simultaneously, first, whether there is an unallocated port is determined by determining whether there is a (port_cur+step) variable in a fourth member variable static list ports _used list, and then the port is allocated. After the allocation is finished, comparing the current allocation quantity with the input variable int port_num, then when the allocation quantity is smaller than the input variable int port_num, continuously confirming whether unallocated ports exist or not and allocating the unallocated ports, and when the allocation quantity is equal to or greater than the input variable int port_num, directly executing step 203, namely ending the dynamic allocation, so that the defect that only 15 mobile phone terminals can be connected simultaneously in the prior art is overcome by effectively dynamically allocating the ports.
According to the device for simultaneously connecting the plurality of mobile phone terminals by the personal computer, when the personal computer is simultaneously connected with the plurality of mobile phone terminals, socket connection ports are directly distributed according to the number of the connected mobile phone terminals, so that the purpose that the personal computer is simultaneously connected with the plurality of mobile phone terminals is achieved.
According to another embodiment of the present invention, when a personal computer is connected to a plurality of mobile terminals at the same time, the personal computer determines whether there is an unassigned port by determining whether there is an (port_cur+step) variable in the fourth member variable static list ports _used list, and then assigns the unassigned port. After the allocation is finished, comparing the current allocation quantity with the input variable int port_num, then continuously confirming whether unallocated ports exist or not and allocating the unallocated ports when the allocation quantity is smaller than the input variable int port_num, and directly returning to the return unit 43 when the allocation quantity is equal to or greater than the input variable int port_num, namely ending the dynamic allocation, thereby overcoming the defect that only 15 mobile phone terminals can be simultaneously connected in the prior art by effectively dynamically allocating the ports.
The technical scheme of the invention is further described in detail through the drawings and the embodiments.
Drawings
Fig. 1 is a flow chart of a method for allocating a socket connection port number to the mobile phone terminal by using a call port dynamic allocation function according to an embodiment of the present invention.
Fig. 2 is a flow chart of a method for allocating a socket connection port number to the mobile phone terminal by using a call port dynamic allocation function according to another embodiment of the present invention.
Fig. 3 is a flowchart of a method for allocating a socket connection port number to the mobile phone terminal by using a call port dynamic allocation function according to still another embodiment of the present invention.
FIG. 4 is a block diagram illustrating a port dynamic allocation function call module according to an embodiment of the present invention.
FIG. 5 is a block diagram of a port dynamic allocation function call module according to another embodiment of the present invention.
FIG. 6 is a block diagram of a port dynamic allocation function call module according to yet another embodiment of the present invention.
Detailed Description
The invention is capable of many modifications and embodiments, and specific embodiments are illustrated in the drawings and described in detail in the detailed description. The effects and features of the present invention, and the method of achieving the same, will be clearly understood with reference to the detailed description of the embodiments while referring to the accompanying drawings. However, the present invention may be implemented in various ways without being limited to the embodiments disclosed below.
In the following embodiments, the terms first, second, etc. are used for the purpose of distinguishing one component element from another, and are not intended to be limiting.
In the following embodiments, with respect to the expression in the singular, the expression in the singular also includes the expression in the plural as long as other meanings are not explicitly indicated in the article.
In the following embodiments, the terms "comprising" or "having" and the like mean that the features or constituent elements described in the specification are present, and are not intended to exclude additional possibilities of one or more other features or constituent elements in advance.
In the following embodiments, when a portion of a film, a region, a constituent element, or the like is located over or on another portion, not only a case of being located directly over the other portion but also a case of providing another film, region, constituent element, or the like therebetween is included.
The dimensions of the constituent elements may be exaggerated or reduced in the drawings for convenience of explanation. For example, the dimensions and thicknesses of the structures shown in the drawings are arbitrarily represented for convenience of explanation, and thus the present invention is not necessarily limited to the illustrations.
In the following embodiments, the x-axis, the y-axis, and the z-axis are not limited to three axes in a rectangular coordinate system, and the x-axis, the y-axis, and the z-axis can be interpreted in a broad sense including these. For example, the x-axis, y-axis, and z-axis may be orthogonal to each other, but may also refer to mutually different directions that are not orthogonal to each other.
In the case where an embodiment is implemented in other ways, the particular sequence of steps may also be implemented differently than as illustrated. For example, two processes described in succession may, in fact, be executed concurrently, and the processes may also be executed in the reverse order of the depicted order.
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings, and when the embodiments are described with reference to the drawings, the same or corresponding constituent elements will be denoted by the same reference numerals, and repeated description of the constituent elements will be omitted.
The method for simultaneously connecting a plurality of mobile phone terminals by the personal computer in the embodiment of the invention can comprise the following steps: the method comprises the steps that a PC provided with an ADB driver is connected with a mobile phone terminal provided with the ADB driver through USB; calling a port dynamic allocation function to allocate a socket connection port number to the mobile phone terminal; adjusting the mobile phone terminal to a mode allowing USB debugging; and establishing communication connection between the PC and the mobile phone terminal.
One embodiment of the invention
The method for simultaneously connecting a plurality of mobile phone terminals by a personal computer according to an embodiment of the present invention is different from the first method embodiment in that a method for allocating a socket connection port number to the mobile phone terminal by calling a port dynamic allocation function is provided. Therefore, the following description will be focused on the distinguishing point.
Fig. 1 is a flow chart of a method for allocating a socket connection port number to the mobile phone terminal by using a call port dynamic allocation function according to an embodiment of the present invention. As shown in fig. 1, the method for allocating a socket connection port number to the mobile phone terminal by using the port dynamic allocation function of the present embodiment may include the following steps.
Step 101, it is determined whether the fourth member variable static list ports _used is empty. Here, if the fourth member variable static list ports _used is empty, it means that any port has not been allocated yet.
In step 102, when the fourth member variable static list ports _used is empty, ports are allocated according to the input variable int port_num. The input variable int port_num represents the port number of the present application. The specific method for allocating the port number is as follows: add port_min, port_min+step, &... Where the third member variable static int port _ cur represents the currently used port.
Step 103, after step 102 is performed, returns directly to the third member variable static int port_cur.
According to the method for simultaneously connecting the plurality of mobile phone terminals by the personal computer, when the personal computer is simultaneously connected with the plurality of mobile phone terminals, socket connection ports are directly distributed according to the number of the connected mobile phone terminals, so that the purpose that the personal computer is simultaneously connected with the plurality of mobile phone terminals is achieved.
Another embodiment of the invention
The method for simultaneously connecting a plurality of mobile phone terminals by a personal computer according to another embodiment of the present invention is different from the first method embodiment in that a method for allocating a socket connection port number to the mobile phone terminal by calling a port dynamic allocation function is provided. Therefore, the following description will be focused on the distinguishing point.
Fig. 2 is a flow chart of a method for allocating a socket connection port number to the mobile phone terminal by using a call port dynamic allocation function according to another embodiment of the present invention. As shown in fig. 2, the method for allocating a socket connection port number to the mobile phone terminal by using the port dynamic allocation function of the present embodiment may include the following steps.
In step 201, it is determined whether the fourth member variable static list ports _used is empty.
In step 202, when the fourth member variable static list ports _used is empty, ports are allocated according to the input variable int port_num.
Step 203, after step 202 is performed, returns directly to the third member variable static int port_cur.
In step 2011, when the fourth member variable static list ports _used is not empty, an attempt is made to allocate (port_cur+step) port.
In step 2012, it is determined whether there is a (port_cur+step) variable in the fourth member variable static list ports _used list. Here, if there is no (port_cur+step) variable in the fourth member variable static list ports _used list, it means that any port has not been allocated, i.e., it means that the port can be allocated.
In step 2013, if the fourth member variable static list ports _used list has no (port_cur+step) variable, the third member variable static int port_cur is assigned as (port_cur+step), and (port_cur+step) is added to the fourth member variable static list ports _used list.
Step 2014, it is determined whether the number of assignments is smaller than the input variable int port_num. If the determination result is that the number of the current allocation is smaller than the input variable int port_num, step 2012 is re-executed; if the determination result is that the number of assignments is not less than the input variable int port_num, i.e. equal to or greater than the input variable int port_num, step 203 is executed.
It should be noted that: the steps 201, 202 and 203 in the method for allocating a socket connection port number to the mobile phone terminal by using the call port dynamic allocation function according to another embodiment of the present invention are similar to the steps 101, 102 and 103 in the method for allocating a socket connection port number to the mobile phone terminal by using the call port dynamic allocation function according to one embodiment of the present invention, so the description of the method for allocating a socket connection port number to the mobile phone terminal by using the call port dynamic allocation function according to another embodiment of the present invention is not expanded.
According to another embodiment of the present invention, when a personal computer connects a plurality of mobile terminals simultaneously, first, whether there is an unallocated port is determined by determining whether there is a (port_cur+step) variable in a fourth member variable static list ports _used list, and then the port is allocated. After the allocation is finished, comparing the current allocation quantity with the input variable int port_num, then when the allocation quantity is smaller than the input variable int port_num, continuously confirming whether unallocated ports exist or not and allocating the unallocated ports, and when the allocation quantity is equal to or greater than the input variable int port_num, directly executing step 203, namely ending the dynamic allocation, so that the defect that only 15 mobile phone terminals can be connected simultaneously in the prior art is overcome by effectively dynamically allocating the ports.
Still another embodiment of the present invention
The method for simultaneously connecting a plurality of mobile phone terminals by a personal computer according to still another embodiment of the present invention is different from the first method embodiment in that a method for allocating a socket connection port number to the mobile phone terminal by calling a port dynamic allocation function is provided. Therefore, the following description will be focused on the distinguishing point.
Fig. 3 is a flowchart of a method for allocating a socket connection port number to the mobile phone terminal by using a call port dynamic allocation function according to still another embodiment of the present invention. As shown in fig. 3, the method for allocating a socket connection port number to the mobile phone terminal by using the port dynamic allocation function of the present embodiment may include the following steps.
In step 301, it is determined whether the fourth member variable static list ports _used is empty.
In step 302, when the fourth member variable static list ports _used is empty, ports are allocated according to the input variable int port_num.
Step 303, after step 302 is performed, returns directly to the third member variable static int port_cur.
At step 3011, when the fourth member variable static list ports _used is not empty, an attempt is made to allocate (port_cur+step) ports.
Step 3012, it is determined whether there is a (port_cur+step) variable in the fourth member variable static list ports _used list.
If the fourth member variable static list ports _used list has no (port_cur+step) variable, step 3013, the third member variable static int port_cur is assigned as (port_cur+step), and (port_cur+step) is added to the fourth member variable static list ports _used list.
Step 3014, it is determined whether the number of assignments is smaller than the input variable int port_num. If the judgment result is that the number of the current allocation is smaller than the input variable int port_num, executing step 3012 again; if the determination result is that the number of assignments is not less than the input variable int port_num, i.e. equal to or greater than the input variable int port_num, step 303 is executed.
In step 3015, if the fourth member variable static list ports _used list has a (port_cur+step) variable, the third member variable static int port_cur is assigned as port_cur+step, and then step 3011 is continued.
It should be noted that: in the method for allocating a socket connection port number to the mobile phone terminal by using the call port dynamic allocation function according to the further embodiment of the present invention, steps 301, 302, 303, 3011, 3012, 3013, 3014 are similar to steps 201, 202, 203, 2011, 2012, 2013, 2014 in the method for allocating a socket connection port number to the mobile phone terminal by using the call port dynamic allocation function according to the further embodiment of the present invention, and therefore, the description of the method for allocating a socket connection port number to the mobile phone terminal by using the call port dynamic allocation function according to the further embodiment of the present invention is not expanded.
The device for simultaneously connecting a plurality of mobile phone terminals by the personal computer in the embodiment of the invention can comprise: the USB connector is used for connecting the PC provided with the ADB driver and the mobile phone terminal provided with the ADB driver; the port dynamic allocation function calling module is used for allocating socket connection port numbers to the mobile phone terminals; the mobile phone terminal debugging module is used for adjusting the mobile phone terminal to a mode allowing USB debugging; and the communication connection establishment module is used for establishing communication connection between the PC and the mobile phone terminal.
One embodiment of the invention
The device for simultaneously connecting a plurality of mobile phone terminals by a personal computer according to an embodiment of the present invention is different from the first device embodiment in the specific configuration of the port dynamic allocation function calling module. Therefore, the following description will be focused on the distinguishing point.
FIG. 4 is a block diagram illustrating a port dynamic allocation function call module according to an embodiment of the present invention. As shown in fig. 4, the port dynamic allocation function calling module of the present embodiment may include the following units.
A first judging unit 41 for judging whether the fourth member variable static list ports _used is empty. Here, if the fourth member variable static list ports _used is empty, it means that any port has not been allocated yet.
The first allocation unit 42 is configured to allocate a port according to the input variable int port_num when the fourth member variable static list ports _used is empty. The input variable int port_num represents the port number of the present application. The specific method for allocating the port number is as follows: add port_min, port_min+step, &... Where the third member variable static int port _ cur represents the currently used port.
A return unit 43, configured to directly return the third member variable static report_cur after the first allocation unit 42 finishes processing.
According to the device for simultaneously connecting the plurality of mobile phone terminals by the personal computer, when the personal computer is simultaneously connected with the plurality of mobile phone terminals, socket connection ports are directly distributed according to the number of the connected mobile phone terminals, so that the purpose that the personal computer is simultaneously connected with the plurality of mobile phone terminals is achieved.
Another embodiment of the invention
The device for simultaneously connecting a plurality of mobile phone terminals with a personal computer according to another embodiment of the present invention is different from the first device embodiment in the specific configuration of the port dynamic allocation function calling module. Therefore, the following description will be focused on the distinguishing point.
Therefore, the following description will be focused on the distinguishing point.
FIG. 5 is a block diagram of a port dynamic allocation function call module according to another embodiment of the present invention. As shown in fig. 5, the port dynamic allocation function calling module of the present embodiment may include the following units.
A first determining unit 51 for determining whether the fourth member variable static list ports _used is empty.
The first allocation unit 52 is configured to allocate ports according to the input variable int port_num when the fourth member variable static list ports _used is empty.
And a return unit 53, configured to directly return the third member variable static report_cur after the first allocation unit 52 finishes processing.
The second allocation unit 511 is configured to allocate a port_cur+step port when the fourth member variable static list ports _used is not empty.
A second determining unit 512, configured to determine whether a port_cur+step variable exists in the fourth member variable static list ports _used list. Here, if there is no (port_cur+step) variable in the fourth member variable static list ports _used list, it means that any port has not been allocated, i.e., it means that the port can be allocated.
The assignment adding unit 513 is configured to assign the third member variable static int port_cur to be port_cur+step and add the port_cur+step to the fourth member variable static list ports _used list if the fourth member variable static list ports _used list has no port_cur+step variable.
A second determining unit 514, configured to determine whether the current allocation number is smaller than the input variable int port_num, and return to the second determining unit 511 if the determination result is that the current allocation number is smaller than the input variable int port_num, and return to the returning unit 53 if the determination result is that the current allocation number is not smaller than the input variable int port_num.
It should be noted that: the first determining unit 51, the first allocating unit 52, and the returning unit 53 in the port dynamic allocation function calling module according to another embodiment of the present invention are similar to the first determining unit 41, the first allocating unit 42, and the returning unit 43 in the port dynamic allocation function calling module according to one embodiment of the present invention, and therefore are not described in the description of the port dynamic allocation function calling module according to another embodiment of the present invention.
According to another embodiment of the present invention, when a personal computer is connected to a plurality of mobile terminals at the same time, the personal computer determines whether there is an unassigned port by determining whether there is an (port_cur+step) variable in the fourth member variable static list ports _used list, and then assigns the unassigned port. After the allocation is finished, comparing the current allocation quantity with the input variable int port_num, then continuously confirming whether unallocated ports exist or not and allocating the unallocated ports when the allocation quantity is smaller than the input variable int port_num, and directly returning to the return unit 43 when the allocation quantity is equal to or greater than the input variable int port_num, namely ending the dynamic allocation, thereby overcoming the defect that only 15 mobile phone terminals can be simultaneously connected in the prior art by effectively dynamically allocating the ports.
Still another embodiment of the present invention
The device for simultaneously connecting a plurality of mobile phone terminals with a personal computer according to still another embodiment of the present invention is different from the first device embodiment in the specific configuration of the port dynamic allocation function calling module. Therefore, the following description will be focused on the distinguishing point.
Therefore, the following description will be focused on the distinguishing point.
FIG. 6 is a block diagram of a port dynamic allocation function call module according to yet another embodiment of the present invention. As shown in fig. 6, the port dynamic allocation function calling module of the present embodiment may include the following units.
A first judging unit 61 for judging whether the fourth member variable static list ports _used is empty.
The first allocation unit 62 is configured to allocate a port according to the input variable int port_num when the fourth member variable static list ports _used is empty.
And a return unit 63, configured to directly return the third member variable static report_cur after the first allocation unit 62 finishes processing.
The second allocation unit 611 is configured to allocate a port_cur+step port when the fourth member variable static list ports _used is not empty.
A second determining unit 612, configured to determine whether a port_cur+step variable exists in the fourth member variable static list ports _used list. Here, if there is no (port_cur+step) variable in the fourth member variable static list ports _used list, it means that any port has not been allocated, i.e., it means that the port can be allocated.
The assignment adding unit 613 is configured to assign the third member variable static int port_cur to be port_cur+step and add the port_cur+step to the fourth member variable static list ports _used list if the fourth member variable static list ports _used list has no port_cur+step variable.
The second determining unit 614 is configured to determine whether the current allocation number is smaller than the input variable int port_num, return to the second determining unit 611 if the determination result is that the current allocation number is smaller than the input variable int port_num, and return to the returning unit 63 if the determination result is that the current allocation number is not smaller than the input variable int port_num.
A rotation unit 615, if the fourth member variable static list ports _used list has a port_cur+step variable, is configured to assign the third member variable static int port_cur to be port_cur+step, and then returns to the second allocation unit 611.
It should be noted that: the first determining unit 61, the first allocating unit 62, the returning unit 63, the second allocating unit 611, the second determining unit 612, the assignment adding unit 613, and the second determining unit 614 in the port dynamic allocation function calling module according to the further embodiment of the present invention are similar to the first determining unit 51, the first allocating unit 52, the returning unit 53, the second allocating unit 511, the second determining unit 512, the assignment adding unit 513, and the second determining unit 514 in the port dynamic allocation function calling module according to the further embodiment of the present invention, and therefore are not described in the description of the port dynamic allocation function calling module according to the further embodiment of the present invention.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware associated with program instructions, where the foregoing program may be stored in a computer readable storage medium, and when executed, the program performs steps including the above method embodiments; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and return of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (2)

1. A method for simultaneously connecting a plurality of mobile terminals by a personal computer, comprising:
the PC provided with the ADB driver is connected with the mobile phone terminal provided with the ADB driver through a USB;
calling a port dynamic allocation function to allocate a socket connection port number to the mobile phone terminal;
adjusting the mobile phone terminal to a mode allowing USB debugging;
establishing communication connection between the PC and the mobile phone terminal;
the step of calling the port dynamic allocation function to allocate the socket connection port number to the mobile phone terminal comprises the following steps:
step 101, judging whether the fourth member variable static list ports _used is empty;
step 102, when the fourth member variable static list ports _used is empty, allocating ports according to the input variable int port_num; and
step 103, after the step 102 is executed, directly returning to the third member variable static report_cur;
step 104, when the fourth member variable static list ports _used is not empty, allocating a port_cur+step port;
step 105, judging whether a port_cur+step variable exists in the fourth member variable static list ports _used list;
step 106, if the fourth member variable static list ports _used list has no port_cur+step variable, assigning the third member variable static int port_cur to be port_cur+step, and adding the port_cur+step to the fourth member variable static list ports _used list;
step 107, judging whether the current allocation number is smaller than the input variable int port_num, if the judgment result is that the current allocation number is smaller than the input variable int port_num, executing step 105 again, and if the judgment result is that the current allocation number is not smaller than the input variable int port_num, executing step 103;
in step 108, if the fourth member variable static list ports _used list has a port_cur+step variable, the third member variable static int port_cur is assigned as port_cur+step, and then step 104 is continued.
2. An apparatus for simultaneously connecting a plurality of mobile terminals by a personal computer, comprising:
the USB connector is used for connecting the PC provided with the ADB driver and the mobile phone terminal provided with the ADB driver;
the port dynamic allocation function calling module is used for allocating socket connection port numbers to the mobile phone terminals;
the mobile phone terminal debugging module is used for adjusting the mobile phone terminal to a mode allowing USB debugging; and
the communication connection establishment module is used for establishing communication connection between the PC and the mobile phone terminal;
the port dynamic allocation function calling module comprises:
a first judging unit configured to judge whether the fourth member variable static list ports _used is empty;
a first allocation unit for allocating ports according to an input variable int port_num when the fourth member variable static list ports _used is empty; and
the return unit is used for directly returning a third member variable static report_cur after the first distribution unit finishes processing;
a second allocation unit configured to allocate a port_cur+step port when the fourth member variable static list ports _used is not empty;
a second judging unit for judging whether a port_cur+step variable exists in the fourth member variable static list ports _used list;
an assignment adding unit, configured to assign the third member variable static int port_cur to be port_cur+step and add the port_cur+step to the fourth member variable static list ports _used list if the fourth member variable static list ports _used list has no port_cur+step variable; and
the second judging unit is used for judging whether the current distribution quantity is smaller than the input variable int port_num, if the judgment result is that the current distribution quantity is smaller than the input variable int port_num, the second judging unit returns to the second judging unit again, and if the judgment result is that the current distribution quantity is not smaller than the input variable int port_num, the second judging unit returns to the returning unit;
and the turning unit is used for assigning the third member variable static int port_cur to be port_cur+step if the fourth member variable static list ports _used list has a port_cur+step variable, and then returning to the second distribution unit.
CN201710586652.1A 2017-07-18 2017-07-18 Method and device for simultaneously connecting multiple mobile phone terminals by personal computer Active CN108073514B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710586652.1A CN108073514B (en) 2017-07-18 2017-07-18 Method and device for simultaneously connecting multiple mobile phone terminals by personal computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710586652.1A CN108073514B (en) 2017-07-18 2017-07-18 Method and device for simultaneously connecting multiple mobile phone terminals by personal computer

Publications (2)

Publication Number Publication Date
CN108073514A CN108073514A (en) 2018-05-25
CN108073514B true CN108073514B (en) 2023-09-05

Family

ID=62159310

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710586652.1A Active CN108073514B (en) 2017-07-18 2017-07-18 Method and device for simultaneously connecting multiple mobile phone terminals by personal computer

Country Status (1)

Country Link
CN (1) CN108073514B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103744761A (en) * 2014-01-22 2014-04-23 广东欧珀移动通信有限公司 Method and system for controlling multiple mobile terminals to automatically execute tasks
CN103927256A (en) * 2013-01-16 2014-07-16 珠海市君天电子科技有限公司 Method for controlling multiple Android devices
CN106844120A (en) * 2017-02-06 2017-06-13 深圳芯智汇科技有限公司 A kind of method and apparatus for binding multi-channel A/D B device and USB port

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104184875B (en) * 2013-05-20 2019-01-11 中兴通讯股份有限公司 Open method, device and the terminal of terminal debugging port

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927256A (en) * 2013-01-16 2014-07-16 珠海市君天电子科技有限公司 Method for controlling multiple Android devices
CN103744761A (en) * 2014-01-22 2014-04-23 广东欧珀移动通信有限公司 Method and system for controlling multiple mobile terminals to automatically execute tasks
CN106844120A (en) * 2017-02-06 2017-06-13 深圳芯智汇科技有限公司 A kind of method and apparatus for binding multi-channel A/D B device and USB port

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
范琛琛.基于ADB调试的Andrio系统植入研究.《信息安全与通信保密》.2015,第96-102页. *

Also Published As

Publication number Publication date
CN108073514A (en) 2018-05-25

Similar Documents

Publication Publication Date Title
US10715381B2 (en) Intelligent role selection for dual-role devices
CN103729234B (en) A kind of cluster virtual machine management method and device
CN109635561A (en) A kind of method, apparatus that BIOS with BMC password setting is synchronous, terminal and storage medium
CN105511936A (en) Test system, method and device
CN113849312A (en) Data processing task allocation method and device, electronic equipment and storage medium
CN110752937B (en) Physical function multiplexing method and device and computer storage medium
CN116320469B (en) Virtualized video encoding and decoding system and method, electronic equipment and storage medium
CN104063284B (en) The method and apparatus running application program
CN104869229A (en) Task allocation method
CN106293313A (en) Multiple solutions generates system and method
CN108234551B (en) Data processing method and device
CN109522021B (en) Parameter callback processing method and device, electronic equipment and storage medium
CN102750493B (en) Access right control method, Apparatus and system
CN108073514B (en) Method and device for simultaneously connecting multiple mobile phone terminals by personal computer
CN113220432B (en) Multi-cloud interconnection method, device, equipment, storage medium and product
US9721174B2 (en) User identification method and electronic device
CN113115304B (en) Virtual number request and transmission method, device and storage medium
CN115277391B (en) Network configuration method, device, cluster and storage medium
CN111324906A (en) Automatic access method and device based on data interface and electronic equipment
CN109819064B (en) Method for communication between modules, operating system module and conference panel
CN112087401A (en) Method and device for realizing service quality in distributed storage
CN112153628A (en) Activation management, instruction processing and restart management method and device for code number resources
TWI617967B (en) System and method for generating multi-interface
CN109542604A (en) The method, apparatus, equipment and storage medium of grouting socket in thread
CN114997102A (en) Physical layer verification method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant