CN109996347B - Method and device for establishing connection between terminal devices - Google Patents
Method and device for establishing connection between terminal devices Download PDFInfo
- Publication number
- CN109996347B CN109996347B CN201711484046.5A CN201711484046A CN109996347B CN 109996347 B CN109996347 B CN 109996347B CN 201711484046 A CN201711484046 A CN 201711484046A CN 109996347 B CN109996347 B CN 109996347B
- Authority
- CN
- China
- Prior art keywords
- connection
- terminal device
- terminal
- information
- terminal equipment
- 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
Links
Images
Landscapes
- Communication Control (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The embodiment of the invention provides a method and a device for establishing connection between terminal equipment, wherein the method for establishing connection between the terminal equipment is applied to first terminal equipment and comprises the following steps: acquiring an identifier of a first terminal device, and after acquiring connection information of the first terminal device, sending a connection establishment request to the first terminal device, wherein the connection establishment request comprises connection information of a second terminal device, and the connection information of the second terminal device is information required by connection establishment between other terminal devices and the second terminal device; receiving a connection establishment request sent by second terminal equipment; and sending a connection establishment response to the second terminal equipment according to the connection information of the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment. The embodiment of the invention can realize convenient and quick data transmission between the terminal devices.
Description
Technical Field
The present invention relates to the field of network transmission technologies, and in particular, to a method and an apparatus for establishing a connection between terminal devices.
Background
In recent years, with the widespread use of terminal devices, data transmission between a plurality of terminal devices has become a frequently used function.
At present, a common method for realizing data transmission among a plurality of terminal devices by using third party software with a data transmission function is adopted; specifically, the same third party software can be installed on a plurality of terminal devices, and the third party software is logged in, so that the plurality of terminal devices can establish connection through the third party software for data transmission.
However, the method for establishing the connection between the plurality of terminal devices requires that the same third party software is installed on each terminal device and the third party software is required to be logged in, so that the use range of the user is limited and the inconvenience is brought to the use of the user.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for establishing connection between terminal equipment so as to realize convenient and quick data transmission between the terminal equipment. The specific technical scheme is as follows:
the embodiment of the invention provides a method for establishing connection between terminal equipment, which is applied to first terminal equipment and comprises the following steps:
acquiring an identifier of the first terminal equipment, wherein the identifier comprises connection information of the first terminal equipment, and the connection information of the first terminal equipment is information required by connection between other terminal equipment and the first terminal equipment;
Receiving a connection establishment request sent by a second terminal device, wherein the connection establishment request is sent by the second terminal device after the identifier of the first terminal device is acquired, the connection establishment request comprises connection information of the second terminal device, and the connection information of the second terminal device is information required by connection establishment between other terminal devices and the second terminal device;
and sending a connection establishment response to the second terminal equipment according to the connection information of the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
Optionally, the acquiring the identifier of the first terminal device includes:
sending an acquisition request to a connection server, wherein the acquisition request comprises connection information of the first terminal equipment;
and receiving an identifier of the first terminal equipment, which is sent by the connection server, wherein the identifier comprises connection information of the first terminal equipment and connection information of the connection server, and the connection information of the connection server is information required by the terminal equipment to identify the connection server.
Optionally, the receiving a connection establishment request from the second terminal device includes:
receiving the connection establishment request forwarded by the connection server from the second terminal equipment;
the sending a connection establishment response to the second terminal device according to the connection information of the second terminal device includes:
and sending the connection establishment response to the connection server according to the connection information of the second terminal equipment, so that the connection server forwards the connection establishment response to the second terminal equipment.
The embodiment of the invention also provides a method for establishing connection between the terminal devices, which is applied to the second terminal device and comprises the following steps:
acquiring connection information of a first terminal device by identifying an identifier of the first terminal device, wherein the connection information of the first terminal device is information required by establishing connection between other terminal devices and the first terminal device;
generating a connection establishment request according to the connection information of the first terminal equipment, wherein the connection establishment request comprises the connection information of the second terminal equipment, and the connection information of the second terminal equipment is information required by establishing connection between other terminal equipment and the second terminal equipment;
Sending the connection establishment request to the first terminal equipment;
and receiving a connection establishment response sent by the first terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
Optionally, the obtaining the connection information of the first terminal device by identifying the identifier of the first terminal device includes:
acquiring connection information of a first terminal device and connection information of a connection server by identifying an identifier of the first terminal device, wherein the connection information of the server is information required by the terminal device to identify the connection server;
the generating a connection establishment request according to the connection information of the first terminal device includes:
generating a connection establishment request according to the connection information of the first terminal equipment and the connection information of the connection server;
the sending the connection establishment request to the first terminal device includes:
sending the connection establishment request to a connection server, so that the connection server forwards the connection establishment request to the first terminal equipment;
the receiving the connection establishment response sent by the first terminal device includes:
And receiving the connection establishment response forwarded by the connection server from the first terminal equipment.
The embodiment of the invention also provides a method for establishing connection between terminal devices, which is applied to a connection server and comprises the following steps:
receiving an acquisition request sent by first terminal equipment, wherein the acquisition request comprises connection information of the first terminal equipment, and the connection information of the first terminal equipment is information required by establishing connection between other terminal equipment and the first terminal equipment;
generating an identifier of the first terminal equipment according to the connection information of the first terminal equipment and the connection information of the connection server, wherein the connection information of the connection server is information required by the terminal equipment to identify the connection server;
transmitting the identifier to the first terminal device;
receiving a connection establishment request sent by the second terminal equipment, wherein the connection establishment request is sent by the second terminal equipment after the identifier of the first terminal equipment is acquired, the connection establishment request comprises connection information of the second terminal equipment, and the connection information of the second terminal equipment is information required by other terminal equipment to establish connection with the second terminal equipment;
And sending a connection establishment response to the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
Optionally, after receiving the connection establishment request sent by the second terminal device, the method further includes:
determining whether the first terminal equipment and the second terminal equipment are in the same local area network according to the connection information of the first terminal equipment and the connection information of the second terminal equipment;
the sending a connection establishment response to the second terminal device includes:
if the first terminal equipment and the second terminal equipment are in the same local area network, sending a connection establishment response to the second terminal equipment, wherein the connection establishment response comprises information for indicating that the first terminal equipment and the second terminal equipment are in the same local area network so as to enable the second terminal equipment and the first terminal equipment to establish bidirectional connection in the same local area network;
if the first terminal equipment and the second terminal equipment are not in the same local area network, forwarding the connection establishment request to the first terminal equipment, and forwarding a connection establishment response sent by the first terminal equipment to the second terminal equipment so as to establish bidirectional connection between the second terminal equipment and the first terminal equipment through the connection server.
The embodiment of the invention further provides a device for establishing connection between the terminal devices, which is applied to the first terminal device, and the device comprises:
an obtaining unit, configured to obtain an identifier of the first terminal device, where the identifier includes connection information of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
a receiving unit, configured to receive a connection establishment request sent by a second terminal device, where the connection establishment request is sent by the second terminal device after obtaining an identifier of the first terminal device, and the connection establishment request includes connection information of the second terminal device, where the connection information of the second terminal device is information required for establishing connection between other terminal devices and the second terminal device;
and the sending unit is used for sending a connection establishment response to the second terminal equipment according to the connection information of the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
The embodiment of the invention further provides a device for establishing connection between the terminal devices, which is applied to the second terminal device, and the device comprises:
An obtaining unit, configured to obtain connection information of a first terminal device by identifying an identifier of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
a generating unit, configured to generate a connection establishment request according to connection information of the first terminal device, where the connection establishment request includes connection information of the second terminal device, where the connection information of the second terminal device is information required for establishing connection between other terminal devices and the second terminal device;
a sending unit, configured to send the connection establishment request to the first terminal device;
and the receiving unit is used for receiving the connection establishment response sent by the first terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
The embodiment of the invention further provides a device for establishing connection between terminal devices, which is applied to a server and comprises the following steps:
a receiving unit, configured to receive an acquisition request sent by a first terminal device, where the acquisition request includes connection information of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
A generating unit, configured to generate an identifier of the first terminal device according to connection information of the first terminal device and connection information of the connection server, where the connection information of the connection server is information required by the terminal device to identify the connection server;
a transmitting unit, configured to transmit the identifier to the first terminal device;
a receiving unit, configured to receive a connection establishment request sent by the second terminal device, where the connection establishment request is sent by the second terminal device after obtaining the identifier of the first terminal device, and the connection establishment request includes connection information of the second terminal device, where connection information of the second terminal device is information required by other terminal devices to establish connection with the second terminal device;
and the sending unit is used for sending a connection establishment response to the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
The embodiment of the invention provides a method and a device for establishing connection between terminal equipment, firstly, a first terminal equipment can acquire an identifier of the first terminal equipment, wherein the identifier corresponds to a storage address for storing connection information of the first terminal equipment; then, receiving a connection establishment request which is from the second terminal equipment and comprises the connection information of the second terminal equipment, wherein the connection establishment request is sent after the second terminal equipment acquires the connection information of the first terminal equipment by scanning the identifier of the first terminal equipment; finally, according to the connection information of the second terminal equipment, a connection establishment response is sent to the second terminal equipment, so that bidirectional connection is established between the first terminal equipment and the second terminal equipment;
In this way, the identifier of the first terminal equipment is acquired by the second terminal equipment, so that the second terminal equipment acquires the connection information of the first terminal equipment, and further, the bidirectional connection between the first terminal equipment and the second terminal equipment is established, and third party software with a data transmission function is not required to be installed on the terminal equipment; therefore, the user can operate more conveniently and rapidly, and the user experience is improved. Of course, it is not necessary for any one product or method of practicing the invention to achieve all of the advantages set forth above at the same time.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for establishing a connection between terminal devices according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for establishing a connection between terminal devices according to an embodiment of the present invention;
Fig. 3 is a flowchart of a method for establishing a connection between terminal devices according to an embodiment of the present invention;
fig. 4 is a block diagram of an apparatus for establishing a connection between terminal devices according to an embodiment of the present invention;
fig. 5 is a further structural diagram of an apparatus for establishing a connection between terminal devices according to an embodiment of the present invention;
fig. 6 is a further structural diagram of an apparatus for establishing a connection between terminal devices according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The embodiment of the invention discloses a method for establishing connection between terminal equipment, which is applied to first terminal equipment, wherein the first terminal equipment is connected with a connection server. Referring to fig. 1, fig. 1 is a flowchart of a method for establishing a connection between terminal devices according to an embodiment of the present invention, including the steps of:
wherein the identifier comprises connection information of the first terminal device; the connection information of the first terminal equipment is information required by the connection between other terminal equipment and the first terminal equipment.
In practical application, the identifier of the first terminal device may be a two-dimensional code, specifically, the two-dimensional code may include connection information of the first terminal device, and other terminal devices may acquire the connection information of the first terminal device by scanning the two-dimensional code on the first terminal device; of course, the identifier of the first terminal device may also be other patterns, such as a bar code, etc., that can correspond to the connection information of the first terminal device.
In addition, the connection information of the first terminal device may be stored in the first terminal device, may be stored in the connection server, or may be stored in another device; the present invention is not limited to a storage device that stores connection information of a first terminal device.
Specifically, in an implementation manner of the embodiment of the present invention, step 101 may specifically include:
sending an acquisition request to a connection server, wherein the acquisition request comprises connection information of the first terminal equipment;
Receiving an identifier of the first terminal device sent by the connection server;
wherein the identifier comprises connection information of the first terminal device and connection information generated by the connection server; the connection information of the connection server is information required by the terminal equipment to identify the connection server.
In practical application, when the first terminal device and the second terminal device are in different local area networks, even if the second terminal device acquires the connection information of the first terminal device, the second terminal device cannot directly perform data interaction with the first terminal device; at this time, the connection server may generate an identifier according to the connection information of the first terminal device and the connection information of the connection server itself, so that the second terminal device may obtain the connection information of the first terminal device and the connection information of the connection server by acquiring the identifier, so as to send information to the first terminal device through the connection server;
specifically, first, connection information of the first terminal device may be transmitted to the connection server; when the first terminal device executes the task of displaying the identifier, the action of sending the connection information of the first terminal device to the connection server can be triggered; next, generating, by the connection server, an identifier of the first terminal device based on the connection information of the first terminal device and the connection information of the connection server; the identifier of the first terminal device then contains the connection information of the first terminal device and the connection information of the connection server, so that the connection server, and thus the connection information of the first terminal device, can be found by means of the identifier.
It will be appreciated that, since the connection information of the connection server is information required for the terminal device to identify the connection server, the connection information of the connection server corresponds to a protocol used for connection between the first terminal device and the second terminal device, and the connection information of the connection server may be different due to a different transmission protocol used for connection between the first terminal device and the second terminal device.
wherein the connection establishment request is sent by the second terminal device after the identifier of the first terminal device is acquired; the connection establishment request comprises connection information of the second terminal equipment, wherein the connection information of the second terminal equipment is information required by establishing connection between other terminal equipment and the second terminal equipment.
In practical application, when the second terminal device needs to perform data transmission with the first terminal device, firstly, the second terminal device obtains connection information of the first terminal device by obtaining an identifier of the first terminal device; further, the second connection device transmits a connection establishment request to the first terminal device according to the connection information of the first terminal device. Specifically, when the identifier of the first terminal device is a two-dimensional code, the second terminal device may obtain the connection information of the first terminal device by scanning the two-dimensional code of the first terminal device, and then send a connection establishment request to the first terminal device according to the obtained connection information of the first terminal device.
It should be noted that, the connection between the first terminal device and the second terminal device may use an existing transmission protocol, such as a TCP/IP protocol, a UDP protocol, etc., and of course, a customized transmission protocol may also be used; the invention does not limit the type of transmission protocol used for the connection between the first terminal device and the second terminal device.
For example, the connection between the first terminal device and the second terminal device uses TCP or UDP protocol, and then the connection information of the first terminal device may be an IP address and a port number of the first terminal device.
It will be appreciated that, since the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device, the connection information of the first terminal device corresponds to a protocol used for connection between the first terminal device and the second terminal device, and the transmission protocols used for connection between the first terminal device and the second terminal device are different, and the connection information of the first terminal device may also be different.
Specifically, in one implementation manner of the embodiment of the present invention, step 102 may specifically include:
receiving the connection establishment request forwarded by the connection server from the second terminal equipment;
In a specific implementation, the connection establishment request from the second terminal device may be forwarded to the first terminal device through the connection server; specifically, the second terminal device may obtain the connection information of the first terminal device and the connection information of the connection server by obtaining the connection information of the first terminal device generated by the connection server; then, the second terminal device can find a connection server according to the connection information of the connection server; further, the second terminal device may send a connection establishment request to the connection server.
In this step, the first terminal device acquires the connection information of the second terminal device through the connection establishment request from the second terminal device.
It will be appreciated that, since the connection information of the second terminal device is information required for establishing connection between the other terminal devices and the second terminal device, the connection information of the second terminal device corresponds to a protocol used for connection between the first terminal device and the second terminal device, and the transmission protocol used for connection between the first terminal device and the second terminal device is different, and the connection information of the second terminal device may also be different.
In the step, the first terminal equipment sends a connection establishment response to the second terminal equipment according to the connection information of the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment and realize data interaction between the first terminal equipment and the second terminal equipment; for a specific procedure, reference may be made to a method of establishing a bi-directional connection of a terminal device in the prior art.
It should be noted that any type of data, such as text data, picture data, video data, audio data, etc., may be mutually transmitted between the first terminal device and the second terminal device.
In addition, the characteristic of the bidirectional connection between the first terminal device and the second terminal device may be determined according to actual requirements, for example, it may be set that the bidirectional connection between the first terminal device and the second terminal device is not actively broken, and since connection establishment, as long as the first terminal device or the second terminal device is not actively disconnected, the bidirectional connection between the first terminal device and the second terminal device may be continuously reserved, so that the first terminal device and the second terminal device may mutually transmit data at any time.
Specifically, in one implementation manner of the embodiment of the present invention, step 103 may specifically include:
And sending the connection establishment response to the connection server according to the connection information of the second terminal equipment, so that the connection server forwards the connection establishment response to the second terminal equipment.
In practical application, a connection establishment response can be sent to the second terminal equipment through the connection server; specifically, first, the first terminal device may send a connection establishment response to the connection server according to the connection information of the second terminal device; further, the connection establishment response from the first terminal device is forwarded by the connection server to the second terminal device.
It can be seen that, in the embodiment of the present invention, the identifier of the first terminal device is acquired by the second terminal device, so that the second terminal device acquires the connection information of the first terminal device, and further, bidirectional connection is established between the first terminal device and the second terminal device, without installing third party software with a data transmission function on the terminal device; in addition, the information interaction between the first terminal equipment and the second terminal equipment in different local area networks can be realized through the connection server, so that the bidirectional connection between the first terminal equipment and the second terminal equipment is established; the user operates more conveniently and rapidly, and user experience is improved.
The embodiment of the invention also discloses a method for establishing the connection between the terminal devices, which is applied to the second terminal device. Referring to fig. 2, fig. 2 is a flowchart of a method for establishing a connection between terminal devices according to an embodiment of the present invention, including the steps of:
the connection information of the first terminal equipment is information required by connection between other terminal equipment and the first terminal equipment.
In the step, when the second terminal equipment needs to perform data interaction with the first terminal equipment, the connection information of the first terminal equipment is obtained by identifying the identifier of the first terminal equipment; in this way, the second terminal device can find the first terminal device according to the connection information of the first terminal device.
In practical application, when the identifier of the first terminal device is a two-dimensional code, the second terminal device may acquire the connection information of the first terminal device by scanning the two-dimensional code of the first terminal device.
Specifically, in one implementation manner of the embodiment of the present invention, step 201 may specifically include:
Acquiring connection information of a first terminal device and connection information of a connection server by identifying an identifier of the first terminal device;
the connection information of the server is information required by the terminal equipment to identify the connection server.
In practical application, when the first terminal device and the second terminal device are in different local area networks, the information between the first terminal device and the second terminal device can be forwarded by the connection server, so that the second terminal device can acquire the connection information of the connection server in addition to the connection information of the first terminal device through identifying the identifier of the first terminal device, and the second terminal device can find the connection server to send the information to the connection server.
the connection establishment request comprises connection information of the second terminal equipment, wherein the connection information of the second terminal equipment is information required by connection between other terminal equipment and the second terminal equipment.
In this step, the connection establishment request for the first terminal device generated by the second terminal device includes connection information of the first terminal device and connection information of the second terminal device.
Specifically, in one implementation manner of the embodiment of the present invention, step 202 may specifically include:
and generating a connection establishment request according to the connection information of the first terminal equipment and the connection information of the connection server.
In practical application, the information between the first terminal device and the second terminal device may be forwarded by the connection server, so that the connection establishment request generated by the second terminal device for the first terminal device includes, in addition to the connection information of the first terminal device and the connection information of the second terminal device, the connection information of the connection server.
in this step, the second terminal device sends a connection establishment request to the first terminal device, requiring that a bidirectional connection is established with the first terminal device, where the connection establishment request includes connection information of the first terminal device and connection information of the second terminal device.
Specifically, in one implementation manner of the embodiment of the present invention, step 203 may specifically include:
and sending the connection establishment request to a connection server so that the connection server forwards the connection establishment request to the first terminal equipment.
In practical application, the information between the first terminal device and the second terminal device may be forwarded by the connection server, so that the second terminal device may send a connection establishment request to the connection server according to the connection information of the connection server, so that the connection server forwards the connection establishment request to the first terminal device.
And 204, receiving a connection establishment response sent by the first terminal equipment, so that bidirectional connection is established between the first terminal equipment and the second terminal equipment.
In the step, the second terminal equipment receives a connection establishment response from the first terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment, thereby realizing data interaction between the first terminal equipment and the second terminal equipment; for a specific procedure, reference may be made to a method of establishing a bi-directional connection of a terminal device in the prior art.
Specifically, in one implementation manner of the embodiment of the present invention, step 204 may specifically include:
and receiving the connection establishment response forwarded by the connection server from the first terminal equipment.
In practical applications, the information between the first terminal device and the second terminal device may be forwarded by the connection server, so that the second terminal device may receive the connection establishment response from the first terminal device through the connection server.
It can be seen that, in the embodiment of the present invention, the second terminal device may acquire the connection information of the first terminal device by acquiring the identifier of the first terminal device, so as to establish bidirectional connection between the first terminal device and the second terminal device; when the first terminal equipment and the second terminal equipment are in different local area networks, information interaction between the first terminal equipment and the second terminal equipment can be realized through a connection server, so that bidirectional connection between the first terminal equipment and the second terminal equipment is established; the user operates more conveniently and rapidly, and user experience is improved.
The embodiment of the invention also discloses a method for establishing connection between the terminal devices, which is applied to the connection server. Referring to fig. 3, fig. 3 is another flowchart of a method for establishing a connection between terminal devices according to an embodiment of the present invention, including the steps of:
the acquisition request comprises connection information of the first equipment, wherein the connection information of the first terminal equipment is information required by establishing connection between other terminal equipment and the first terminal equipment.
In practical application, when the first terminal device and the second terminal device are in different local area networks, information interaction between the first terminal device and the second terminal device needs to be realized through a connection server.
In this step, the connection server receives an acquisition request for an identifier from the first terminal device.
the connection information of the connection server is information required by the terminal equipment to identify the connection server.
In this step, the connection server generates an identifier of the first terminal device based on the connection information of the first device and the connection information of the connection server itself. It will be appreciated that the identifier of the first terminal device comprises connection information of the first device and connection information of the connection server.
in this step, the connection server transmits an identifier to the first terminal device according to the connection information of the first device included in the acquisition request.
the connection establishment request is sent by the second terminal device after the identifier of the first terminal device is acquired, the connection establishment request comprises connection information of the second terminal device, and the connection information of the second terminal device is information required by other terminal devices to establish connection with the second terminal device.
In practical application, after the connection server sends the identifier to the first terminal device, the second terminal device obtains the connection information of the first device and the connection information of the connection server by obtaining the identifier of the first terminal device, so that the second terminal device can send a connection establishment request for the first terminal device to the connection server according to the connection information of the connection server.
In this step, the connection server receives a connection establishment request from the second terminal device, wherein the connection establishment request contains connection information of the second terminal device.
Specifically, in one implementation manner of the embodiment of the present invention, after step 304, the method may further include:
and determining whether the first terminal equipment and the second terminal equipment are in the same local area network according to the connection information of the first terminal equipment and the connection information of the second terminal equipment.
Since the connection server acquires the connection information of the first terminal device from the acquisition request from the first terminal device and acquires the connection information of the second terminal device from the connection establishment request from the second terminal device, the connection server can determine whether the first terminal device and the second terminal device are in the same local area network according to the connection information of the first terminal device and the connection information of the second terminal device.
The specific process of determining whether the first terminal device and the second terminal device are in the same local area network by the connection server according to the connection information of the first terminal device and the connection information of the second terminal device can refer to the prior art.
For example, when the connection information of the first terminal device and the second terminal device are both IP addresses, the connection server may perform an and operation on the IP address of the first terminal device and the corresponding mask, and perform an and operation on the IP address of the second terminal device and the corresponding mask; if the operation result of the IP address of the first terminal device is the same as the operation result of the IP address of the second terminal device, the first terminal device and the second terminal device are in the same local area network, and if the operation result of the IP address of the first terminal device is different from the operation result of the IP address of the second terminal device, the first terminal device and the second terminal device are in different local area networks.
And step 305, sending a connection establishment response to the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
In this step, the connection server sends a connection establishment response to the second terminal device according to the connection establishment request from the second terminal device, so that a bidirectional connection is established between the first terminal device and the second terminal device.
Specifically, in one implementation manner of the embodiment of the present invention, step 305 may specifically include:
if the first terminal equipment and the second terminal equipment are in the same local area network, sending a connection establishment response to the second terminal equipment, wherein the connection establishment response comprises information for indicating that the first terminal equipment and the second terminal equipment are in the same local area network so as to enable the second terminal equipment and the first terminal equipment to establish bidirectional connection in the same local area network;
if the first terminal equipment and the second terminal equipment are in different local area networks, forwarding the connection establishment request to the first terminal equipment, and forwarding a connection establishment response sent by the first terminal equipment to the second terminal equipment so as to establish bidirectional connection between the second terminal equipment and the first terminal equipment through the connection server.
In an alternative implementation manner, when the first terminal device and the second terminal device are in the same local area network, the connection server may send a connection establishment response to the second terminal device, where the connection establishment response includes information for indicating that the first terminal device and the second terminal device are in the same local area network; when the second terminal device receives the connection establishment response from the connection server, it can be determined that the second terminal device is in the same local area network as the first terminal device, so that the second terminal device can establish bidirectional connection with the first terminal device in the same local area network without passing through the connection server, and compared with the case that the first terminal device and the second terminal device are in different local area networks, the information transmission rate between the first terminal device and the second terminal device in the same local area network is faster, and of course, the second terminal device and the first terminal device can also establish bidirectional connection in the same local area network through the connection server, which can be determined according to practical situations.
When the first terminal device and the second terminal device are in different local area networks, the connection server may forward a connection establishment request from the second terminal device to the first terminal device; after receiving the connection establishment request, the first terminal equipment sends a connection establishment response to the connection server; then, after receiving the connection establishment response, the connection server forwards the connection establishment response to the second terminal device, so that a bidirectional connection is established between the second terminal device and the first terminal device through the connection server.
It can be seen that in the embodiment of the present invention, the connection server may determine whether the first terminal device and the second terminal device are in the same local area network; when the first terminal equipment and the second terminal equipment are in the same local area network, the second terminal equipment can establish bidirectional connection with the first terminal equipment in the same local area network without connecting with a server; when the first terminal device and the second terminal device are in different local area networks, the two-way connection between the second terminal device and the first terminal device can be established through the connection server.
The embodiment of the invention further discloses a device for establishing the connection between the terminal devices, which is applied to the first terminal device. Referring to fig. 4, fig. 4 is a block diagram of an apparatus for establishing a connection between terminal devices according to an embodiment of the present invention, where the apparatus corresponds to a method flow shown in fig. 1, and the apparatus includes:
An obtaining unit 401, configured to obtain an identifier of the first terminal device, where the identifier includes connection information of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
a receiving unit 402, configured to receive a connection establishment request sent by a second terminal device, where the connection establishment request is sent by the second terminal device after obtaining an identifier of the first terminal device, and the connection establishment request includes connection information of the second terminal device, where the connection information of the second terminal device is information required for establishing connection between other terminal devices and the second terminal device;
and a sending unit 403, configured to send a connection establishment response to the second terminal device according to the connection information of the second terminal device, so that a bidirectional connection is established between the first terminal device and the second terminal device.
Optionally, the acquiring unit 401 includes: a transmitting subunit and a receiving subunit;
the sending subunit is configured to send an acquisition request to a connection server, where the acquisition request includes connection information of the first terminal device;
The receiving subunit is configured to receive an identifier of the first terminal device sent by the connection server, where the identifier includes connection information of the first terminal device and connection information of the connection server, where the connection information of the connection server is information required for identifying the connection server by the terminal device.
Optionally, the receiving unit 402 is specifically configured to receive the connection establishment request forwarded by the connection server from the second terminal device;
the sending unit 403 is specifically configured to send the connection establishment response to the connection server according to the connection information of the second terminal device, so that the connection server forwards the connection establishment response to the second terminal device.
It can be seen that, in the embodiment of the present invention, the identifier of the first terminal device is acquired by the second terminal device, so that the second terminal device acquires the connection information of the first terminal device, and further, bidirectional connection is established between the first terminal device and the second terminal device, without installing third party software with a data transmission function on the terminal device; in addition, the information interaction between the first terminal equipment and the second terminal equipment in different local area networks can be realized through the connection server, so that the bidirectional connection between the first terminal equipment and the second terminal equipment is established; the user operates more conveniently and rapidly, and user experience is improved.
The embodiment of the invention further discloses a device for establishing the connection between the terminal devices, which is applied to the second terminal device. Referring to fig. 5, fig. 5 is a further structural diagram of an apparatus for establishing a connection between terminal devices according to an embodiment of the present invention, where the apparatus corresponds to the method flow shown in fig. 2, and the apparatus includes:
an obtaining unit 501, configured to obtain connection information of a first terminal device by identifying an identifier of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
a generating unit 502, configured to generate a connection establishment request according to connection information of the first terminal device, where the connection establishment request includes connection information of the second terminal device, where the connection information of the second terminal device is information required for establishing connection between other terminal devices and the second terminal device;
a sending unit 503, configured to send the connection establishment request to the first terminal device;
and a receiving unit 504, configured to receive a connection establishment response sent by the first terminal device, so that a bidirectional connection is established between the first terminal device and the second terminal device.
Optionally, the acquiring unit 501 is specifically configured to acquire, by identifying an identifier of a first terminal device, connection information of the first terminal device and connection information of a connection server, where the connection information of the server is information required by the terminal device to identify the connection server;
the generating unit 502 is specifically configured to generate a connection establishment request according to the connection information of the first terminal device and the connection information of the connection server;
the sending unit 503 is specifically configured to send the connection establishment request to a connection server, so that the connection server forwards the connection establishment request to the first terminal device;
the receiving unit 504 is specifically configured to receive the connection establishment response from the first terminal device forwarded by the connection server.
It can be seen that, in the embodiment of the present invention, the second terminal device may acquire the connection information of the first terminal device by acquiring the identifier of the first terminal device, so as to establish bidirectional connection between the first terminal device and the second terminal device; when the first terminal equipment and the second terminal equipment are in different local area networks, information interaction between the first terminal equipment and the second terminal equipment can be realized through a connection server, so that bidirectional connection between the first terminal equipment and the second terminal equipment is established; the user operates more conveniently and rapidly, and user experience is improved.
The embodiment of the invention further discloses a device for establishing the connection between the terminal devices, which is applied to the connection server. Referring to fig. 6, fig. 6 is another structural diagram of an apparatus for establishing a connection between terminal devices according to an embodiment of the present invention, which corresponds to the method flow shown in fig. 3, and includes:
a receiving unit 601, configured to receive an acquisition request sent by a first terminal device, where the acquisition request includes connection information of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
a generating unit 602, configured to generate an identifier of the first terminal device according to connection information of the first terminal device and connection information of the connection server, where the connection information of the connection server is information required by the terminal device to identify the connection server;
a transmitting unit 603, configured to transmit the identifier to the first terminal device;
a receiving unit 601, configured to receive a connection establishment request sent by the second terminal device, where the connection establishment request is sent by the second terminal device after obtaining the identifier of the first terminal device, and the connection establishment request includes connection information of the second terminal device, where connection information of the second terminal device is information required for establishing connection between other terminal devices and the second terminal device;
And the sending unit 603 is configured to send a connection establishment response to the second terminal device, so that a bidirectional connection is established between the first terminal device and the second terminal device.
Optionally, the apparatus further includes: a determining unit, configured to determine whether the first terminal device and the second terminal device are in the same local area network according to the connection information of the first terminal device and the connection information of the second terminal device;
the transmitting unit 603 includes: a transmitting subunit;
the sending subunit is configured to send the connection establishment response to the second terminal device if the first terminal device and the second terminal device are in the same local area network, where the connection establishment response includes information for indicating that the first terminal device and the second terminal device are in the same local area network, so that the second terminal device and the first terminal device establish bidirectional connection in the same local area network;
and the sending subunit is configured to forward the connection establishment request to the first terminal device and forward a connection establishment response sent by the first terminal device to the second terminal device if the first terminal device and the second terminal device are not in the same local area network, so that bidirectional connection is established between the second terminal device and the first terminal device through the connection server.
It can be seen that in the embodiment of the present invention, the connection server may determine whether the first terminal device and the second terminal device are in the same local area network; when the first terminal equipment and the second terminal equipment are in the same local area network, the second terminal equipment can establish bidirectional connection with the first terminal equipment in the same local area network without connecting with a server; when the first terminal device and the second terminal device are in different local area networks, the two-way connection between the second terminal device and the first terminal device can be established through the connection server.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims (8)
1. A method of establishing a connection between terminal devices, applied to a first terminal device, the method comprising:
acquiring an identifier of the first terminal equipment, wherein the identifier comprises connection information of the first terminal equipment, and the connection information of the first terminal equipment is information required by connection between other terminal equipment and the first terminal equipment;
receiving a connection establishment request sent by a second terminal device, wherein the connection establishment request is sent by the second terminal device after the identifier of the first terminal device is acquired, the connection establishment request comprises connection information of the second terminal device, and the connection information of the second terminal device is information required by connection establishment between other terminal devices and the second terminal device;
According to the connection information of the second terminal equipment, a connection establishment response is sent to the second terminal equipment, so that bidirectional connection is established between the first terminal equipment and the second terminal equipment;
wherein the obtaining the identifier of the first terminal device includes:
sending an acquisition request to a connection server, wherein the acquisition request comprises connection information of the first terminal equipment;
and receiving an identifier of the first terminal equipment, which is sent by the connection server, wherein the identifier is generated according to the connection information of the first terminal equipment and the connection information of the connection server, and the connection information of the connection server is information required by the terminal equipment to identify the connection server.
2. The method of claim 1, wherein the receiving a connection establishment request from the second terminal device comprises:
receiving the connection establishment request forwarded by the connection server from the second terminal equipment;
the sending a connection establishment response to the second terminal device according to the connection information of the second terminal device includes:
and sending the connection establishment response to the connection server according to the connection information of the second terminal equipment, so that the connection server forwards the connection establishment response to the second terminal equipment.
3. A method of establishing a connection between terminal devices, characterized in that it is applied to a second terminal device, the method comprising:
acquiring connection information of a first terminal device by identifying an identifier of the first terminal device, wherein the connection information of the first terminal device is information required by establishing connection between other terminal devices and the first terminal device;
generating a connection establishment request according to the connection information of the first terminal equipment, wherein the connection establishment request comprises the connection information of the second terminal equipment, and the connection information of the second terminal equipment is information required by establishing connection between other terminal equipment and the second terminal equipment;
sending the connection establishment request to the first terminal equipment;
receiving a connection establishment response sent by the first terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment;
wherein the obtaining the connection information of the first terminal device by identifying the identifier of the first terminal device includes:
acquiring connection information of a first terminal device and connection information of a connection server by identifying an identifier of the first terminal device, wherein the connection information of the server is information required by the terminal device to identify the connection server;
The generating a connection establishment request according to the connection information of the first terminal device includes:
generating a connection establishment request according to the connection information of the first terminal equipment and the connection information of the connection server;
the sending the connection establishment request to the first terminal device includes:
sending the connection establishment request to a connection server, so that the connection server forwards the connection establishment request to the first terminal equipment;
the receiving the connection establishment response sent by the first terminal device includes:
and receiving the connection establishment response forwarded by the connection server from the first terminal equipment.
4. A method for establishing a connection between terminal devices, applied to a connection server, the method comprising:
receiving an acquisition request sent by first terminal equipment, wherein the acquisition request comprises connection information of the first terminal equipment, and the connection information of the first terminal equipment is information required by connection between other terminal equipment and the first terminal equipment;
generating an identifier of the first terminal equipment according to the connection information of the first terminal equipment and the connection information of the connection server, wherein the connection information of the connection server is information required by the terminal equipment to identify the connection server;
Transmitting the identifier to the first terminal device;
receiving a connection establishment request sent by a second terminal device, wherein the connection establishment request is sent by the second terminal device after the identifier of the first terminal device is acquired, the connection establishment request comprises connection information of the second terminal device, and information required by connection information of other terminal devices of the second terminal device and the second terminal device;
and sending a connection establishment response to the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
5. The method of claim 4, further comprising, after receiving the connection establishment request sent by the second terminal device:
determining whether the first terminal equipment and the second terminal equipment are in the same local area network according to the connection information of the first terminal equipment and the connection information of the second terminal equipment;
the sending a connection establishment response to the second terminal device includes:
if the first terminal equipment and the second terminal equipment are in the same local area network, sending a connection establishment response to the second terminal equipment, wherein the connection establishment response comprises information for indicating that the first terminal equipment and the second terminal equipment are in the same local area network so as to enable the second terminal equipment and the first terminal equipment to establish bidirectional connection in the same local area network;
If the first terminal equipment and the second terminal equipment are not in the same local area network, forwarding the connection establishment request to the first terminal equipment, and forwarding a connection establishment response sent by the first terminal equipment to the second terminal equipment so as to establish bidirectional connection between the second terminal equipment and the first terminal equipment through the connection server.
6. An apparatus for establishing a connection between terminal devices, applied to a first terminal device, the apparatus comprising:
an obtaining unit, configured to obtain an identifier of the first terminal device, where the identifier includes connection information of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
a receiving unit, configured to receive a connection establishment request sent by a second terminal device, where the connection establishment request is sent by the second terminal device after obtaining an identifier of the first terminal device, and the connection establishment request includes connection information of the second terminal device, where the connection information of the second terminal device is information required for establishing connection between other terminal devices and the second terminal device;
A sending unit, configured to send a connection establishment response to the second terminal device according to the connection information of the second terminal device, so that bidirectional connection is established between the first terminal device and the second terminal device;
the acquiring unit is specifically configured to send an acquiring request to a connection server, where the acquiring request includes connection information of the first terminal device; and receiving an identifier of the first terminal equipment, which is sent by the connection server, wherein the identifier is generated according to the connection information of the first terminal equipment and the connection information of the connection server, and the connection information of the connection server is information required by the terminal equipment to identify the connection server.
7. An apparatus for establishing a connection between terminal devices, applied to a second terminal device, the apparatus comprising:
an obtaining unit, configured to obtain connection information of a first terminal device by identifying an identifier of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
a generating unit, configured to generate a connection establishment request according to connection information of the first terminal device, where the connection establishment request includes connection information of the second terminal device, where the connection information of the second terminal device is information required for establishing connection between other terminal devices and the second terminal device;
A sending unit, configured to send the connection establishment request to the first terminal device;
a receiving unit, configured to receive a connection establishment response sent by the first terminal device, so that bidirectional connection is established between the first terminal device and the second terminal device;
the acquiring unit is specifically configured to acquire connection information of a first terminal device and connection information of a connection server by identifying an identifier of the first terminal device, where the connection information of the server is information required by the terminal device to identify the connection server;
the generating unit is specifically configured to generate a connection establishment request according to the connection information of the first terminal device and the connection information of the connection server;
the sending unit is specifically configured to send the connection establishment request to a connection server, so that the connection server forwards the connection establishment request to the first terminal device;
the receiving unit is specifically configured to receive the connection establishment response from the first terminal device forwarded by the connection server.
8. An apparatus for establishing a connection between terminal devices, applied to a server, comprising:
A receiving unit, configured to receive an acquisition request sent by a first terminal device, where the acquisition request includes connection information of the first terminal device, where the connection information of the first terminal device is information required for establishing connection between other terminal devices and the first terminal device;
a generating unit, configured to generate an identifier of the first terminal device according to connection information of the first terminal device and connection information of a connection server, where the connection information of the connection server is information required by the terminal device to identify the connection server;
a transmitting unit, configured to transmit the identifier to the first terminal device;
a receiving unit, configured to receive a connection establishment request sent by a second terminal device, where the connection establishment request is sent by the second terminal device after obtaining an identifier of the first terminal device, and the connection establishment request includes connection information of the second terminal device, where the connection information of the second terminal device is information required by other terminal devices to establish connection with the second terminal device;
and the sending unit is used for sending a connection establishment response to the second terminal equipment so as to establish bidirectional connection between the first terminal equipment and the second terminal equipment.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711484046.5A CN109996347B (en) | 2017-12-29 | 2017-12-29 | Method and device for establishing connection between terminal devices |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711484046.5A CN109996347B (en) | 2017-12-29 | 2017-12-29 | Method and device for establishing connection between terminal devices |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109996347A CN109996347A (en) | 2019-07-09 |
CN109996347B true CN109996347B (en) | 2023-05-23 |
Family
ID=67110290
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711484046.5A Active CN109996347B (en) | 2017-12-29 | 2017-12-29 | Method and device for establishing connection between terminal devices |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109996347B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103067919A (en) * | 2012-12-21 | 2013-04-24 | 北京奇虎科技有限公司 | Building method and authenticating method for connection between computing device and mobile device |
CN104202830A (en) * | 2004-12-03 | 2014-12-10 | 意大利电信股份公司 | Implementation of composite service in communication network |
CN104301857A (en) * | 2014-09-24 | 2015-01-21 | 广州三星通信技术研究有限公司 | Method and device for wireless communication between communication terminals |
CN104981025A (en) * | 2014-04-02 | 2015-10-14 | 腾讯科技(深圳)有限公司 | Terminal pairing method, terminal pairing device, server and terminal |
CN105472771A (en) * | 2014-09-12 | 2016-04-06 | 小米科技有限责任公司 | Wireless connection method and device |
CN105472698A (en) * | 2015-11-30 | 2016-04-06 | 小米科技有限责任公司 | Wireless network access method and device |
CN105578398A (en) * | 2016-01-27 | 2016-05-11 | 努比亚技术有限公司 | Terminal, and Bluetooth connection method |
CN106686754A (en) * | 2016-12-06 | 2017-05-17 | 厦门中控生物识别信息技术有限公司 | Data interaction method and data interaction system |
-
2017
- 2017-12-29 CN CN201711484046.5A patent/CN109996347B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104202830A (en) * | 2004-12-03 | 2014-12-10 | 意大利电信股份公司 | Implementation of composite service in communication network |
CN103067919A (en) * | 2012-12-21 | 2013-04-24 | 北京奇虎科技有限公司 | Building method and authenticating method for connection between computing device and mobile device |
CN104981025A (en) * | 2014-04-02 | 2015-10-14 | 腾讯科技(深圳)有限公司 | Terminal pairing method, terminal pairing device, server and terminal |
CN105472771A (en) * | 2014-09-12 | 2016-04-06 | 小米科技有限责任公司 | Wireless connection method and device |
CN104301857A (en) * | 2014-09-24 | 2015-01-21 | 广州三星通信技术研究有限公司 | Method and device for wireless communication between communication terminals |
CN105472698A (en) * | 2015-11-30 | 2016-04-06 | 小米科技有限责任公司 | Wireless network access method and device |
CN105578398A (en) * | 2016-01-27 | 2016-05-11 | 努比亚技术有限公司 | Terminal, and Bluetooth connection method |
CN106686754A (en) * | 2016-12-06 | 2017-05-17 | 厦门中控生物识别信息技术有限公司 | Data interaction method and data interaction system |
Also Published As
Publication number | Publication date |
---|---|
CN109996347A (en) | 2019-07-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102638586B (en) | Sharing method, system and device for application program information | |
WO2019114417A1 (en) | Information transmission method and device | |
CN105812402B (en) | File transmission method and device based on Internet of things | |
EP2134114A1 (en) | Method for providing to an end device access to a service, to an end device and to a mobile terminal realizing such a method | |
WO2017041381A1 (en) | Method and system for multiple services to share long connection, and apparatus and terminal therefor | |
CN101667949A (en) | Aggregated user presence management method within a home network and device thereof | |
CN104780183A (en) | Information sharing method, device and electronic device | |
US10291621B2 (en) | System, information processing apparatus, and storage medium | |
CN111263338A (en) | Network distribution method of Bluetooth Mesh network and related network distribution equipment and system | |
CN104867263A (en) | Camera positioning alarm method and system | |
CN105959188B (en) | Method and device for controlling user terminal to be on-line | |
US9801035B2 (en) | System and method to identify devices in a shared mobile operating plan | |
CN104506405B (en) | The method and device of cross-domain access | |
CN108377210B (en) | Local area network multi-device identification method | |
CN109996347B (en) | Method and device for establishing connection between terminal devices | |
CN105323128A (en) | Method, device and system for connecting front-end device to server | |
CN104168302A (en) | Device control realizing method, device control realizing system and proxy gateway | |
KR101432039B1 (en) | Method for remote monitoring using IP camera | |
KR101942158B1 (en) | Network security method and apparatus thereof | |
CN105812422B (en) | File transmission method and device based on Internet of things | |
KR101585138B1 (en) | Security device connecting system and method using a Peer to Peer relay demon | |
JP2017195604A5 (en) | Communication system, communication method and program | |
JP2018516478A5 (en) | ||
US20150281946A1 (en) | Communication Agent Method | |
JP2004234292A (en) | Communication system |
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 |