CN109981796B - Connection method and device - Google Patents

Connection method and device Download PDF

Info

Publication number
CN109981796B
CN109981796B CN201910280872.0A CN201910280872A CN109981796B CN 109981796 B CN109981796 B CN 109981796B CN 201910280872 A CN201910280872 A CN 201910280872A CN 109981796 B CN109981796 B CN 109981796B
Authority
CN
China
Prior art keywords
mobile terminal
server
connection
main control
information
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
CN201910280872.0A
Other languages
Chinese (zh)
Other versions
CN109981796A (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.)
Puxin Hengye Technology Development Beijing Co ltd
Yiren Hengye Technology Development Beijing Co ltd
Original Assignee
Puxin Hengye Technology Development Beijing Co ltd
Yiren Hengye Technology Development Beijing 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 Puxin Hengye Technology Development Beijing Co ltd, Yiren Hengye Technology Development Beijing Co ltd filed Critical Puxin Hengye Technology Development Beijing Co ltd
Priority to CN201910280872.0A priority Critical patent/CN109981796B/en
Publication of CN109981796A publication Critical patent/CN109981796A/en
Application granted granted Critical
Publication of CN109981796B publication Critical patent/CN109981796B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephonic Communication Services (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application discloses a connection method and a connection device, which are used for shortening the time of connection between a main control device and a mobile terminal. The method comprises the following steps: the method comprises the steps that a server receives a connection request from a main control device, wherein the connection request carries device information of a mobile terminal; and the server confirms that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and returns a connection success message to the main control equipment.

Description

Connection method and device
Technical Field
The present application relates to the field of computers, and in particular, to a connection method and apparatus.
Background
With the rapid development of the mobile internet, mobile terminals (e.g., mobile phones, tablet computers, etc.) are increasingly replacing Personal Computers (PCs) as tools used by people most. Mobile terminals provide services for people's work and life by installing and running Applications (APPs).
In some application scenarios, the mobile terminal needs to be connected with the main control device, so as to achieve the purpose of operating the application program of the mobile terminal. For example, in an automated test, a main control device is connected to a plurality of mobile terminals, and the main control device is used for testing an application program installed on the plurality of mobile terminals.
However, the current problem is that the process time for the main control device to establish connection with the mobile terminal is long, which results in low operation efficiency of the main control device on the application program of the mobile terminal.
Disclosure of Invention
In order to solve the problem that the process time for establishing connection between the main control device and the mobile terminal is long in the prior art, the application provides a connection method and a connection device, which are used for shortening the connection time between the main control device and the mobile terminal.
In a first aspect, an embodiment of the present application provides a connection method, where the method includes:
the method comprises the steps that a server receives a connection request from a main control device, wherein the connection request carries device information of a mobile terminal;
and the server confirms that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and returns a connection success message to the main control equipment.
Optionally, the device information of the mobile terminal includes an address of the mobile terminal and a port number of the mobile terminal, and a port corresponding to the port number of the mobile terminal is a port through which the mobile terminal is connected to the server.
Optionally, if the server has established a connection with the mobile terminal, the method further includes:
the server stores the mapping relation between the equipment information of the mobile terminal and the process information of the connection process, wherein the connection process is a process which is established by the server and is connected with the mobile terminal.
Optionally, the process information of the connection process includes a port number of the server and/or a process identifier of the connection process, and a port corresponding to the port number of the server is a port through which the server is connected to the mobile terminal.
Optionally, the method further includes:
the server generates a mapping relation between the session identification and the equipment information of the mobile terminal;
the connection success message comprises the session identification.
Optionally, the method further includes:
the server receives a service request from the main control equipment, wherein the service request comprises the session identifier;
and the server determines the corresponding equipment information of the mobile terminal according to the session identifier and the mapping relation between the session identifier and the equipment information of the mobile terminal, and forwards the service request to the mobile terminal corresponding to the equipment information, wherein the service request is used for processing an application program of the mobile terminal.
Optionally, the number of the master control devices is multiple, where the multiple master control devices include a first master control device, and the connection request further carries an identifier of the first master control device;
the server confirms that the server establishes connection with the mobile terminal according to the device information of the mobile terminal, and returns a connection success message to the main control device includes:
and the server confirms that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and the identifier of the first main control equipment, and returns a connection success message to the main control equipment if the mobile terminal is not occupied by other main control equipment except the first main control equipment.
Optionally, the method further includes:
the server sends a page source code acquisition request to the mobile terminal, wherein the page source code acquisition request is used for acquiring screen information of the mobile terminal;
and if the server receives the screen information of the mobile terminal from the mobile terminal, confirming that the server is connected with the mobile terminal.
In a second aspect, an embodiment of the present application provides a connection apparatus, where the apparatus is applied to a server, and the apparatus includes:
a first receiving unit, configured to receive a connection request from a master control device, where the connection request carries device information of a mobile terminal;
and the connection unit is used for confirming that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and returning a connection success message to the main control equipment.
Optionally, the device information of the mobile terminal includes an address of the mobile terminal and a port number of the mobile terminal, and a port corresponding to the port number of the mobile terminal is a port through which the mobile terminal is connected to the server.
Optionally, if the server has established a connection with the mobile terminal, the apparatus further includes:
and the storage unit is used for storing the mapping relation between the equipment information of the mobile terminal and the process information of the connection process, wherein the connection process is a process which is established by the server and is connected with the mobile terminal.
Optionally, the process information of the connection process includes a port number of the server and/or a process identifier of the connection process, and a port corresponding to the port number of the server is a port through which the server is connected to the mobile terminal.
Optionally, the apparatus further comprises:
the generating unit is used for generating a mapping relation between the session identifier and the equipment information of the mobile terminal;
the connection success message comprises the session identification.
Optionally, the apparatus further comprises:
a second receiving unit, configured to receive a service request from the master device, where the service request includes the session identifier;
and the forwarding unit is used for determining the corresponding equipment information of the mobile terminal according to the session identifier and the mapping relation between the session identifier and the equipment information of the mobile terminal, and forwarding the service request to the mobile terminal corresponding to the equipment information, wherein the service request is used for processing an application program of the mobile terminal.
Optionally, the number of the master control devices is multiple, where the multiple master control devices include a first master control device, and the connection request further carries an identifier of the first master control device;
and the connection unit is used for confirming that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and the identifier of the first main control equipment, and returning a connection success message to the main control equipment if the mobile terminal is not occupied by other main control equipment except the first main control equipment.
Optionally, the apparatus further comprises:
a sending unit, configured to send a page source code obtaining request to the mobile terminal, where the page source code obtaining request is used to obtain screen information of the mobile terminal;
a confirming unit, configured to confirm that the server and the mobile terminal are connected if the server receives screen information of the mobile terminal from the mobile terminal.
According to the connection method provided by the embodiment of the application, the main control equipment is not directly connected with the mobile terminal, but is connected through the server. The server and the mobile terminal are connected in advance, and when the server receives a connection request sent by the main control device, the server and the mobile terminal are connected, so that a connection success message can be returned to the main control device. By the method, the connection time of the main control equipment and the mobile terminal is shortened, and the connection efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a connection method according to an embodiment of the present application;
fig. 2 is a block diagram of a connection system according to an embodiment of the present disclosure;
fig. 3 is a signaling interaction diagram provided by the connection system shown in fig. 2 according to the embodiment of the present application;
fig. 4 is a block diagram of a connection device according to an embodiment of the present disclosure.
Detailed Description
In this embodiment, the main control device refers to a device capable of operating an application program of a mobile terminal, and the main control device may be the mobile terminal or a server. The main control device may run application control software, such as app software, through which control of the application on the mobile terminal is achieved.
In the embodiment of the application, the mobile terminal may be a device capable of installing an application, such as a mobile phone and a tablet computer. An Android (Android) system, an apple (ios) system and other operating systems can be installed on the mobile terminal. The application installed on the mobile terminal is developed based on the corresponding operating system.
At present, the time for the main control device to establish connection with the mobile terminal is long. Taking the Appium software as an example, the process of establishing connection with the mobile terminal includes: and creating an Apdium process, then sending a connection request to the mobile terminal through the Apdium process, and receiving a connection success message sent by the mobile terminal. The main control device needs to execute the steps every time the main control device establishes connection with the mobile terminal, so that the connection efficiency is low.
In order to solve the foregoing technical problem, an embodiment of the present application provides a connection method, in which a main control device is not directly connected to a mobile terminal, but is connected through a server. The server is used for establishing connection with the mobile terminal in advance, and when the server receives a connection request sent by the main control equipment, the server already establishes connection with the mobile terminal, so that a connection success message can be returned to the main control equipment. That is to say, the method shortens the connection time between the main control device and the mobile terminal and improves the connection efficiency.
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, a flowchart of a connection method according to an embodiment of the present application is shown.
The connection method provided by the embodiment comprises the following steps:
s101: the server receives a connection request from the main control equipment, wherein the connection request carries equipment information of the mobile terminal.
In the embodiment of the application, the connection request is a request initiated by the main control device and used for establishing connection with the mobile terminal. The connection request carries the device information of the mobile terminal. The device information of the mobile terminal may be, for example, information such as an address of the mobile terminal and a port number of the mobile terminal. The address of the mobile terminal may be an Internet Protocol (IP) address. And the port number port of the mobile terminal is a port for connecting the mobile terminal and the server.
S102: and the server confirms that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and returns a connection success message to the main control equipment.
In the embodiment of the application, the server may establish a connection with the mobile terminal in advance. After the connection is established, a status bit may be set, the value in which may be used to indicate that the server has established a connection with the mobile terminal. After establishing the connection, the server may also store device information of the mobile terminal for which the connection has been established and associate the device information of the mobile terminal with the status bit. In this way, after the server receives the connection request of the main control device, the server obtains the value of the corresponding status bit according to the device information of the mobile terminal carried in the connection request, and if the value of the status bit indicates that the server has established connection with the mobile terminal, the server returns a connection success message to the main control device. That is to say, in the embodiment of the present application, by establishing and maintaining a connection between the intermediate device, such as the server, and the mobile terminal, when the main control device needs to be connected to the mobile terminal, the main control device can obtain a connection success message in time, so that the time for establishing a connection between the main control device and the mobile terminal is shortened, and the connection efficiency is improved.
In the embodiment of the present application, there may be three values in the status bit, and the three values respectively represent different statuses of the connection between the server and the mobile terminal: connected, connecting and disconnecting.
If the value in the status bit indicates that the server and the mobile terminal are being connected or disconnected when the server receives the connection request from the main control device, the server may return a connection success message to the main control device after completing the connection with the mobile terminal and modifying the value of the status bit from being connected or disconnected to being connected.
After the server establishes connection with the mobile terminal, a mapping relationship between a session identifier and the device information of the mobile terminal may be generated, and the mapping relationship between the session identifier and the device information of the mobile terminal may characterize that the server establishes connection with the mobile terminal. Therefore, when the server returns a connection success message to the main control device, the server can inform the main control device that the server has established connection with the mobile terminal by carrying the session identifier. Next, the main control device may send a service request to the server, where the service request carries the session identifier, and the server may determine, according to the session identifier and a mapping relationship between the session identifier and the device information of the mobile terminal, the device information of the corresponding mobile terminal, and forward the service request to the mobile terminal corresponding to the device information of the mobile terminal, so as to implement processing on the application program in the mobile terminal.
In this embodiment of the present application, the process of establishing a connection between the server and the mobile terminal may be: the method comprises the steps that a server creates a connection process for connecting with a mobile terminal, and then sends a page source code acquisition request to the mobile terminal through the connection process, wherein the page source code acquisition request is used for acquiring screen information of the mobile terminal. And if the server receives the screen information of the mobile terminal, which is sent to the server by the mobile terminal according to the page source code acquisition request, the server is confirmed to be connected with the mobile terminal. In the embodiment of the application, the page source code acquisition request sent by the server to the mobile terminal does not affect the processing of the application program on the mobile terminal, that is, the request does not belong to the service request, and the connection between the server and the mobile terminal is realized through the page source code acquisition request.
After the server establishes connection with the mobile terminal for the first time, a mapping relationship between the device information of the mobile terminal and the process information of the connection process may be generated and stored. The process information of the connection process may be, for example, one or more of port number of the server, process identification of the connection process, and the like. And the port corresponding to the port number of the server is a port for connecting the server and the mobile terminal. The process identification of the connection process is used for uniquely identifying the connection process.
When the server receives a service request from the main control device, the server can determine the corresponding device information of the mobile terminal according to the session identifier in the service request, then find the connection process corresponding to the session identifier according to the mapping relationship between the device information of the mobile terminal and the process information of the connection process, and forward the service request through the connection process.
In order to enable the main control device to establish a connection with the mobile terminal as soon as possible, in the embodiment of the present application, after the server establishes a connection with the mobile terminal, the connection state may be maintained all the time. Specifically, the server may periodically send a page source code acquisition request to the mobile terminal to maintain a connection with the mobile terminal.
In addition, in the embodiment of the present application, one server may be connected to a plurality of master control devices. It is assumed that when the main control device that sends the connection request to the server is the first main control device, and the first main control device sends the connection request to the server, the connection request may carry an identifier of the first main control device in addition to the device identifier of the mobile terminal (optionally, the session identifier may also be carried in the connection request). When the server receives a connection request from first main control equipment, according to the equipment information of the mobile terminal and the identification of the first main control equipment, the server is confirmed to be connected with the mobile terminal, and the mobile terminal is not occupied by other main control equipment except the first main control equipment, and then a connection success message is returned to the main control equipment.
Specifically, the server may determine whether the server is connected to the mobile terminal according to the device information of the mobile terminal, and if the connection is established, determine whether the mobile terminal is occupied by other main control devices except the first main control device according to the identifier of the first main control device, and if the connection is not occupied, the server may send a connection success message to the main control device, and the server may establish a mapping relationship between the identifier of the first main control device and the process information or session identifier of the connection process, to represent that the mobile terminal is occupied by the first main control device. During the period that the mobile terminal is occupied by the first main control device, the server can forward the service request to the mobile terminal for the first main control device. In some application scenarios, if other master control devices except the first master control device send a connection request to the server while the mobile terminal is occupied by the first master control device, the server may ignore the connection request or send a connection failure message to the master control device. When the first main control device sends a disconnection request to the server, the server may delete the mapping relationship between the identifier of the first main control device and the process information or session identifier of the connection process, so as to release the state of the mobile terminal occupied by the first main control device. After the release, the mobile terminal may be connected by any one of the master devices.
In order to understand the technical solution of the connection method provided in the embodiment of the present application, an application scenario is taken as an example to be described in detail below.
Referring to fig. 2, the figure is a block diagram of a connection system according to an embodiment of the present application.
The connection system provided by the embodiment of the present application includes a main control device 100, a server 200, and a mobile terminal 300. The main control device 100 is connected to the server 200, and the server 200 is connected to the mobile terminal 300.
Referring to fig. 3, it is a signaling interaction diagram provided by the embodiment of the present application based on the connection system shown in fig. 2.
S201: the server 200 establishes a connection with the mobile terminal 300.
The process of establishing the connection between the server 200 and the mobile terminal 300 includes: the server 200 creates an Appium process, and sends a page source code acquisition request to the mobile terminal 300 through the Appium process. The mobile terminal 300 acquires the screen information of the mobile terminal 300 according to the page source code acquisition request, and transmits the screen information of the mobile terminal 300 to the server 200. The server 200 receives screen information of the mobile terminal 300, sets a status bit for the mobile terminal 300, and sets a value of the status bit to indicate connected.
The server 200 acquires the device information of the mobile terminal 300 through configuration and the like, and generates a mapping relationship between the device information of the mobile terminal 300 and the process information and the session identifier of the app process.
After the first connection, the server 200 periodically sends a page source acquisition request to the mobile terminal 300 to maintain the connection with the mobile terminal 300.
S202: the main control device 100 transmits a connection request including an identifier of the main control device 100 and device information of the mobile terminal 300 to the server 200.
S203: the server 200 receives the connection request, determines that the value of the status bit corresponding to the mobile terminal 300 indicates connection according to the device information of the mobile terminal 300 in the connection request, determines a corresponding session identifier according to the device information of the mobile terminal 300 and the mapping relationship, and establishes the mapping relationship between the identifier of the main control device 100 and the session identifier.
For example, table 1 may be generated in server 200 from a connection request.
TABLE 1
Figure BDA0002021603840000091
In table 1, a status bit of 1 indicates that the server 200 has established a connection with the mobile terminal 300.
In addition, after the server 200 receives the connection request and determines that the value of the status bit corresponding to the mobile terminal 300 indicates that the connection has been made according to the device information of the mobile terminal 300 in the connection request, the server 200 needs to determine whether the identifier of the main control device corresponding to the session identifier exists in table 1, and if the identifier of the main control device does not exist in table 1, it indicates that the mobile terminal 300 is not occupied by the main control device at this time, and at this time, the correspondence between the session identifier and the identifier of the main control device 100 may be established; if so, the connection request may be discarded and a connection failure message returned to master device 100.
S204: the server 200 sends a connection success message to the main control device 100, where the connection success message carries the session identifier.
S205: the main control device 100 receives the connection success message, acquires the session identifier from the connection success message, and sends a service request to the server 200, where the service request carries the session identifier and the identifier of the main control device 100.
S206: the server 200 receives the service request, judges whether the identifier of the main control device 100 corresponding to the session identifier stored in the server 200 is the same as the identifier of the main control device 100 carried in the service request according to the session identifier in the service request, if so, confirms that the service request is legal, and executes S207; if not, the service request is confirmed to be illegal, and the service request can be discarded.
S207: the server 200 finds a corresponding app process according to the session identifier in the service request and the mapping relationship between the session identifier and the process information of the app process, and then forwards the service request to the mobile terminal 300 through the app process.
S208: the mobile terminal 300 processes the application according to the service request.
S209: the main control device 100 sends a disconnection request to the server 200, where the disconnection request carries a session identifier.
S210: the server 200 receives the disconnection request, and deletes the identifier of the main control device 100 corresponding to the session identifier in the server 200 according to the session identifier in the disconnection request.
In the embodiment of the present application, the server 200 may not perform the step of disconnecting the connection with the mobile terminal 300 when receiving the disconnection request, but maintain the connection all the time.
Based on the connection method provided by the above embodiment, the embodiment of the present application further provides a connection device, and the working principle of the connection device is described in detail below with reference to the accompanying drawings.
Referring to fig. 4, an embodiment of the present application provides a connection apparatus, where the apparatus is applied to a server, and the apparatus includes:
a first receiving unit 401, configured to receive a connection request from a main control device, where the connection request carries device information of a mobile terminal;
a connection unit 402, configured to confirm that the server has established a connection with the mobile terminal according to the device information of the mobile terminal, and return a connection success message to the main control device.
Optionally, the device information of the mobile terminal includes an address of the mobile terminal and a port number of the mobile terminal, and a port corresponding to the port number of the mobile terminal is a port through which the mobile terminal is connected to the server.
Optionally, if the server has established a connection with the mobile terminal, the apparatus further includes:
and the storage unit is used for storing the mapping relation between the equipment information of the mobile terminal and the process information of the connection process, wherein the connection process is a process which is established by the server and is connected with the mobile terminal.
Optionally, the process information of the connection process includes a port number of the server and/or a process identifier of the connection process, and a port corresponding to the port number of the server is a port through which the server is connected to the mobile terminal.
Optionally, the apparatus further comprises:
the generating unit is used for generating a mapping relation between the session identifier and the equipment information of the mobile terminal;
the connection success message comprises the session identification.
Optionally, the apparatus further comprises:
a second receiving unit, configured to receive a service request from the master device, where the service request includes the session identifier;
and the forwarding unit is used for determining the corresponding equipment information of the mobile terminal according to the session identifier and the mapping relation between the session identifier and the equipment information of the mobile terminal, and forwarding the service request to the mobile terminal corresponding to the equipment information, wherein the service request is used for processing an application program of the mobile terminal.
Optionally, the number of the master control devices is multiple, where the multiple master control devices include a first master control device, and the connection request further carries an identifier of the first master control device;
and the connection unit is used for confirming that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and the identifier of the first main control equipment, and returning a connection success message to the main control equipment if the mobile terminal is not occupied by other main control equipment except the first main control equipment.
Optionally, the apparatus further comprises:
a sending unit, configured to send a page source code obtaining request to the mobile terminal, where the page source code obtaining request is used to obtain screen information of the mobile terminal;
a confirming unit, configured to confirm that the server and the mobile terminal are connected if the server receives screen information of the mobile terminal from the mobile terminal.
When introducing elements of various embodiments of the present application, the articles "a," "an," "the," and "said" are intended to mean that there are one or more of the elements. The terms "comprising," "including," and "having" are intended to be inclusive and mean that there may be additional elements other than the listed elements.
It should be noted that, as one of ordinary skill in the art would understand, all or part of the processes of the above method embodiments may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when executed, the computer program may include the processes of the above method embodiments. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to some descriptions of the method embodiment for relevant points. The above-described apparatus embodiments are merely illustrative, and the units and modules described as separate components may or may not be physically separate. In addition, some or all of the units and modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The foregoing is directed to embodiments of the present application and it is noted that numerous modifications and adaptations may be made by those skilled in the art without departing from the principles of the present application and are intended to be within the scope of the present application.

Claims (16)

1. A method of connection, the method comprising:
a server receives a connection request from a main control device, wherein the connection request carries device information of a mobile terminal and an identifier of the main control device; the main control equipment is equipment capable of operating an application program of the mobile terminal;
the step that the server confirms that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal comprises the following steps: according to the equipment information of the mobile terminal, obtaining a value of a state bit corresponding to the equipment information, and determining that the value of the state bit indicates that the server is connected with the mobile terminal, wherein the state bit is set for the mobile terminal after the server is connected with the mobile terminal, the value in the state bit is used for indicating the connection state between the server and the mobile terminal, and the values in the state bit respectively represent three connection states of connected, connected and disconnected; and judging whether the mobile terminal is occupied by other main control equipment except the main control equipment according to the identifier of the main control equipment, and if not, returning a connection success message to the main control equipment.
2. The method according to claim 1, wherein the device information of the mobile terminal includes an address of the mobile terminal and a port number of the mobile terminal, and a port corresponding to the port number of the mobile terminal is a port through which the mobile terminal is connected to the server.
3. The method according to claim 1 or 2, wherein if the server has established a connection with the mobile terminal, the method further comprises:
the server stores the mapping relation between the equipment information of the mobile terminal and the process information of the connection process, wherein the connection process is a process which is established by the server and is connected with the mobile terminal.
4. The method according to claim 3, wherein the process information of the connection process includes a port number of the server and/or a process identifier of the connection process, and a port corresponding to the port number of the server is a port through which the server is connected to the mobile terminal.
5. The method of claim 1, further comprising:
the server generates a mapping relation between the session identification and the equipment information of the mobile terminal;
the connection success message comprises the session identification.
6. The method of claim 5, further comprising:
the server receives a service request from the main control equipment, wherein the service request comprises the session identifier;
and the server determines the corresponding equipment information of the mobile terminal according to the session identifier and the mapping relation between the session identifier and the equipment information of the mobile terminal, and forwards the service request to the mobile terminal corresponding to the equipment information, wherein the service request is used for processing an application program of the mobile terminal.
7. The method according to claim 1, wherein the number of the master control devices is multiple, the multiple master control devices include a first master control device, and the connection request further carries an identifier of the first master control device;
the server confirms that the server establishes connection with the mobile terminal according to the device information of the mobile terminal, and returns a connection success message to the main control device includes:
and the server confirms that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and the identifier of the first main control equipment, and returns a connection success message to the main control equipment if the mobile terminal is not occupied by other main control equipment except the first main control equipment.
8. The method of claim 1, further comprising:
the server sends a page source code acquisition request to the mobile terminal, wherein the page source code acquisition request is used for acquiring screen information of the mobile terminal;
and if the server receives the screen information of the mobile terminal from the mobile terminal, confirming that the server is connected with the mobile terminal.
9. A connection apparatus, wherein the apparatus is applied to a server, the apparatus comprising:
a first receiving unit, configured to receive a connection request from a main control device, where the connection request carries device information of a mobile terminal and an identifier of the main control device; the main control equipment is equipment capable of operating an application program of the mobile terminal;
the connection unit is used for confirming that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and comprises the following steps: according to the equipment information of the mobile terminal, obtaining a value of a state bit corresponding to the equipment information, and determining that the value of the state bit indicates that the server is connected with the mobile terminal, wherein the state bit is set for the mobile terminal after the server is connected with the mobile terminal, the value in the state bit is used for indicating the connection state between the server and the mobile terminal, and the values in the state bit respectively represent three connection states of connected, connected and disconnected; and judging whether the mobile terminal is occupied by other main control equipment except the main control equipment according to the identifier of the main control equipment, and if not, returning a connection success message to the main control equipment.
10. The apparatus according to claim 9, wherein the device information of the mobile terminal includes an address of the mobile terminal and a port number of the mobile terminal, and a port corresponding to the port number of the mobile terminal is a port through which the mobile terminal is connected to the server.
11. The apparatus according to claim 9 or 10, wherein if the server has established a connection with the mobile terminal, the apparatus further comprises:
and the storage unit is used for storing the mapping relation between the equipment information of the mobile terminal and the process information of the connection process, wherein the connection process is a process which is established by the server and is connected with the mobile terminal.
12. The apparatus according to claim 11, wherein the process information of the connection process includes a port number of the server and/or a process identifier of the connection process, and a port corresponding to the port number of the server is a port to which the server is connected to the mobile terminal.
13. The apparatus of claim 9, further comprising:
the generating unit is used for generating a mapping relation between the session identifier and the equipment information of the mobile terminal;
the connection success message comprises the session identification.
14. The apparatus of claim 13, further comprising:
a second receiving unit, configured to receive a service request from the master device, where the service request includes the session identifier;
and the forwarding unit is used for determining the corresponding equipment information of the mobile terminal according to the session identifier and the mapping relation between the session identifier and the equipment information of the mobile terminal, and forwarding the service request to the mobile terminal corresponding to the equipment information, wherein the service request is used for processing an application program of the mobile terminal.
15. The apparatus according to claim 9, wherein the number of the master control devices is multiple, the multiple master control devices include a first master control device, and the connection request further carries an identifier of the first master control device;
and the connection unit is used for confirming that the server establishes connection with the mobile terminal according to the equipment information of the mobile terminal and the identifier of the first main control equipment, and returning a connection success message to the main control equipment if the mobile terminal is not occupied by other main control equipment except the first main control equipment.
16. The apparatus of claim 9, further comprising:
a sending unit, configured to send a page source code obtaining request to the mobile terminal, where the page source code obtaining request is used to obtain screen information of the mobile terminal;
a confirming unit, configured to confirm that the server and the mobile terminal are connected if the server receives screen information of the mobile terminal from the mobile terminal.
CN201910280872.0A 2019-04-09 2019-04-09 Connection method and device Active CN109981796B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910280872.0A CN109981796B (en) 2019-04-09 2019-04-09 Connection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910280872.0A CN109981796B (en) 2019-04-09 2019-04-09 Connection method and device

Publications (2)

Publication Number Publication Date
CN109981796A CN109981796A (en) 2019-07-05
CN109981796B true CN109981796B (en) 2022-03-01

Family

ID=67083676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910280872.0A Active CN109981796B (en) 2019-04-09 2019-04-09 Connection method and device

Country Status (1)

Country Link
CN (1) CN109981796B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115568036B (en) * 2022-10-14 2023-10-20 荣耀终端有限公司 Application connection method, electronic equipment, chip and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571853A (en) * 2010-12-16 2012-07-11 中国移动通信集团四川有限公司 Method, system and device for remote point-to-point communication of mobile terminals
CN104253814A (en) * 2014-09-12 2014-12-31 清华大学 Streaming media processing method, server and browser
WO2015051674A1 (en) * 2013-10-09 2015-04-16 北京奇虎科技有限公司 Method, system and device for network authorization based on no password or random password
CN108632265A (en) * 2018-04-26 2018-10-09 广州视源电子科技股份有限公司 Communication connecting method, device, system and the storage medium of client

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107612954A (en) * 2016-07-12 2018-01-19 鸿富锦精密电子(天津)有限公司 Control terminal, mobile device, mobile device control system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571853A (en) * 2010-12-16 2012-07-11 中国移动通信集团四川有限公司 Method, system and device for remote point-to-point communication of mobile terminals
WO2015051674A1 (en) * 2013-10-09 2015-04-16 北京奇虎科技有限公司 Method, system and device for network authorization based on no password or random password
CN104253814A (en) * 2014-09-12 2014-12-31 清华大学 Streaming media processing method, server and browser
CN108632265A (en) * 2018-04-26 2018-10-09 广州视源电子科技股份有限公司 Communication connecting method, device, system and the storage medium of client

Also Published As

Publication number Publication date
CN109981796A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
JP6139800B2 (en) Management method, related device and system for embedded universal integrated circuit card
CN108810123B (en) Method and apparatus for provisioning mobile cellular network services
EP3396905A1 (en) Method and device for securely sending a message
CN109819023B (en) Distributed transaction processing method and related product
CN113900941A (en) Micro-service processing method, micro-service system, electronic device and storage medium
CN105099763A (en) Method and device for reminding lost connection of equipment
CN104539508A (en) Access control method and device
CN109981796B (en) Connection method and device
CN113067769B (en) Router restarting method, device, equipment and storage medium
CN113423120A (en) Data distribution processing method and device based on private network terminal and electronic equipment
CN112398738B (en) Method and device for acquiring connection relation, equipment and computer readable storage medium
CN113872812A (en) Information processing method, network equipment and terminal equipment
CN106534758B (en) Conference backup method and device
CN108632355B (en) Routing method for household appliance network, control terminal, readable storage medium and equipment
CN107682271B (en) Method and device for generating routing line
CN116821215A (en) OPC UA server searching method based on port inquiry
CN101340642A (en) Method, system and apparatus for transmitting electronic business card
CN113986995A (en) Request distribution method and device, storage medium and electronic equipment
CN111641987B (en) Method for processing based on service, terminal equipment, network equipment and computer storage medium
CN112532509A (en) Cross-application communication method and related device
CN106331270B (en) Method and device for managing numbers of contact persons
CN112822644A (en) Group establishing method and equipment
CN113422772B (en) Private network terminal access processing method and device and electronic equipment
CN104254057A (en) Short message transmission method, system and equipment
CN108173910B (en) Method and system for managing application

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