CN110809330B - Multi-terminal connection establishment method and device, storage medium and electronic device - Google Patents

Multi-terminal connection establishment method and device, storage medium and electronic device Download PDF

Info

Publication number
CN110809330B
CN110809330B CN201911296679.2A CN201911296679A CN110809330B CN 110809330 B CN110809330 B CN 110809330B CN 201911296679 A CN201911296679 A CN 201911296679A CN 110809330 B CN110809330 B CN 110809330B
Authority
CN
China
Prior art keywords
terminal
connection
address
connection establishment
establishment request
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
CN201911296679.2A
Other languages
Chinese (zh)
Other versions
CN110809330A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201911296679.2A priority Critical patent/CN110809330B/en
Publication of CN110809330A publication Critical patent/CN110809330A/en
Application granted granted Critical
Publication of CN110809330B publication Critical patent/CN110809330B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/18Management of setup rejection or failure

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention discloses a connection establishment method and device for multiple terminals, a storage medium and an electronic device. Wherein the method comprises the following steps: acquiring a second IP address of a second terminal on the first terminal; transmitting a first connection establishment request to a second IP address on a first terminal; under the condition that the first connection establishment fails, acquiring a second connection establishment request sent by a second terminal to the first IP address on the first terminal; and establishing the second connection between the first terminal and the second terminal in response to a second connection establishment request. The invention solves the technical problem that the mobile phone end and the PC end cannot be connected.

Description

Multi-terminal connection establishment method and device, storage medium and electronic device
Technical Field
The present invention relates to the field of computers, and in particular, to a method and apparatus for establishing connection between multiple terminals, a storage medium, and an electronic apparatus.
Background
The screen picture is captured through a client Application program (App) of the mobile phone end, and is sent to a server of a personal computer (Personal Computer, PC) end after being coded and compressed, and then decoded and displayed, so that the picture of the mobile phone is displayed on the PC.
In the existing screen projection scheme, a monitoring server is built at a PC end, then connection is initiated at a mobile phone end, and a data stream is routed from a mobile phone APP to a network and finally to the server of the PC. However, the PC side is generally provided with a firewall, and if the firewall on the PC side is not configured, the data packet may be intercepted by the network firewall on the PC side, so that the connection fails.
Aiming at the problem that in the related art, the firewall at the PC end intercepts the data packet, so that the connection between the mobile phone end and the PC end cannot be established, no effective solution is proposed at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for establishing connection of multiple terminals, a storage medium and an electronic device, which are used for at least solving the technical problem that a mobile phone end and a PC end cannot be established.
According to an aspect of an embodiment of the present invention, there is provided a connection establishment method for a multi-terminal, including: acquiring a second IP address of a second terminal on the first terminal; a first connection establishment request is sent to the second IP address on the first terminal, wherein the first connection establishment request carries the first IP address of the first terminal, and the first connection establishment request is used for requesting to establish a first connection between the first terminal and the second terminal; acquiring a second connection establishment request sent by the second terminal to the first IP address on the first terminal under the condition that the first connection establishment fails, wherein the second connection establishment request is used for requesting to establish a second connection between the first terminal and the second terminal; and establishing the second connection between the first terminal and the second terminal in response to the second connection establishment request.
According to another aspect of the embodiment of the present invention, there is also provided a connection establishment apparatus for a multi-terminal, including: the first acquisition module is used for acquiring a second IP address of the second terminal on the first terminal; a sending module, configured to send a first connection establishment request to the second IP address on the first terminal, where the first connection establishment request carries a first IP address of the first terminal, and the first connection establishment request is used to request establishment of a first connection between the first terminal and the second terminal; a second obtaining module, configured to obtain, on the first terminal, a second connection establishment request sent by the second terminal to the first IP address, where the second connection establishment request is used to request establishment of a second connection between the first terminal and the second terminal, where the first connection establishment failure occurs; and the establishing module is used for responding to the second connection establishing request and establishing the second connection between the first terminal and the second terminal.
According to yet another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the above-described connection establishment method for multiple terminals when run.
According to still another aspect of the embodiments of the present invention, there is further provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the method for establishing a connection between multiple terminals through the computer program.
In the embodiment of the invention, a first connection request is sent to the acquired IP address of the second terminal through the first terminal, and the first connection request is used for requesting to establish the first connection between the first terminal and the second terminal. And under the condition that the first connection establishment fails, a second connection establishment request is sent to the first terminal by the second terminal and is used for requesting to establish a second connection between the first terminal and the second terminal, and the second connection is established between the first terminal and the second terminal. Therefore, the technical effect of establishing connection between the mobile phone end and the PC end is achieved, and the technical problem that connection cannot be established between the mobile phone end and the PC end is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
fig. 1 is a flowchart of a connection establishment method of a multi-terminal according to an embodiment of the present invention;
fig. 2 is a schematic diagram one of an alternative multi-terminal connection establishment method in accordance with an alternative embodiment of the present invention;
fig. 3 is a schematic diagram two of an alternative multi-terminal connection establishment method according to an alternative embodiment of the present invention;
fig. 4 is a schematic diagram III of an alternative multi-terminal connection establishment method in accordance with an alternative embodiment of the invention;
fig. 5 is a schematic diagram IV of an alternative multi-terminal connection establishment method according to an alternative embodiment of the invention;
fig. 6 is a schematic view of an application environment of an alternative multi-terminal connection establishment method according to an embodiment of the present invention;
fig. 7 is a schematic diagram five of an alternative multi-terminal connection establishment method in accordance with an alternative embodiment of the invention;
fig. 8 is a schematic diagram six of an alternative multi-terminal connection establishment method in accordance with an alternative embodiment of the present invention;
fig. 9 is a schematic diagram seven of an alternative multi-terminal connection establishment method in accordance with an alternative embodiment of the invention;
fig. 10 is a schematic diagram eight of an alternative multi-terminal connection establishment method in accordance with an alternative embodiment of the invention;
fig. 11 is a schematic diagram of an alternative multi-terminal connection establishment apparatus according to an embodiment of the present invention;
fig. 12 is a schematic structural view of an alternative electronic device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of the embodiment of the present invention, there is provided a connection establishment method for a multi-terminal, as an optional implementation manner, as shown in fig. 1, the connection establishment method for a multi-terminal includes the following steps:
step S102, a second IP address of a second terminal is acquired from the first terminal;
step S104, a first connection establishment request is sent to the second IP address on the first terminal, wherein the first connection establishment request carries the first IP address of the first terminal, and the first connection establishment request is used for requesting to establish a first connection between the first terminal and the second terminal;
step S106, under the condition that the first connection establishment fails, a second connection establishment request sent by the second terminal to the first IP address is obtained on the first terminal, wherein the second connection establishment request is used for requesting to establish a second connection between the first terminal and the second terminal;
step S108, in response to the second connection establishment request, establishes the second connection between the first terminal and the second terminal.
Alternatively, the first terminal may be a mobile phone terminal, and the second terminal may be a PC terminal. The mobile phone end and the PC end can communicate data through a real-time message transmission protocol (Real Time Messaging Protocol, RTMP for short). Specifically, the mobile phone terminal can establish connection with the PC terminal by scanning a two-dimensional code request of the PC terminal, the two-dimensional code can be provided by an application program installed on the PC terminal or provided by a webpage, and specifically, the application program can be an application program of a live game electronic contest, and the application program has a function of mobile phone screen throwing. When the mobile phone terminal scans the two-dimension code of the PC terminal, the mobile phone terminal can acquire the IP address of the PC terminal through the two-dimension code, and the PC terminal can also acquire the IP address of the mobile phone terminal through a connection establishment request sent by the mobile phone terminal. Under the condition that the connection establishment with the PC end requested by the mobile phone end fails, the PC end can send a connection establishment request to the mobile phone end according to the IP address of the mobile phone end. Because the mobile phone end has no firewall problem, the data connection between the PC end and the mobile phone end can be realized through the reverse request connection of the PC end.
As an alternative implementation manner, taking live broadcasting of a game screen currently being displayed on a mobile phone interface on a PC side as an example, an application program with a screen throwing function is installed on the PC side, which may be referred to as a first application program. The main interface of the application program with the screen throwing function at the PC end is shown in FIG. 2. By clicking a screen throwing control in the interface, a two-dimensional code shown in figure 3 is displayed in an application program of the PC end, and the two-dimensional code carries an IP address of the PC end.
The mobile phone end is provided with an application program with a screen throwing function, which can be called a second application program, and as shown in fig. 4, the main interface of the application program with the screen throwing function of the mobile phone end is shown. Selecting a touch button of 'computer screen projection', displaying a 'scanning two-dimensional code' interface shown in fig. 5 on a mobile phone terminal interface, wherein the mobile phone terminal scans the two-dimensional code of the PC terminal to establish connection with the PC terminal, and the PC terminal can acquire the IP address of the mobile phone terminal from the request of the mobile phone terminal while the mobile phone terminal scans the two-dimensional code of the PC terminal. If the firewall of the PC end prevents the connection establishment requested by the mobile phone end, the PC end can send the connection establishment request to the mobile phone end in a backward direction through the acquired IP address of the mobile phone end. Because the mobile phone end does not have the firewall problem, the mobile phone end responds to the connection request initiated by the PC end to establish data connection with the PC end.
Through the steps, a first connection request is sent to the acquired IP address of the second terminal through the first terminal, and the first connection request is used for requesting to establish the first connection between the first terminal and the second terminal. And under the condition that the first connection establishment fails, a second connection establishment request is sent to the first terminal by the second terminal and is used for requesting to establish a second connection between the first terminal and the second terminal, and the second connection is established between the first terminal and the second terminal. Therefore, the technical effect of establishing connection between the mobile phone end and the PC end is achieved, and the technical problem that connection cannot be established between the mobile phone end and the PC end is solved.
Alternatively, as an alternative embodiment, the above-mentioned connection establishment method of multiple terminals may be applied, but not limited to, in the environment shown in fig. 6.
Optionally, in this embodiment, the connection establishment of the multiple terminals may be, but not limited to, applied to a hardware environment formed by a first terminal, a second terminal and a background server, where the first terminal may be a mobile phone terminal, the second terminal may be a PC terminal such as a tablet computer, a notebook computer, and the like, and both the first terminal and the second terminal support running application clients. The background server and the first terminal and the second terminal can realize data interaction through a network, and the network can include a wireless network or a wired network. Wherein the wireless network comprises: bluetooth, WIFI, and other networks that enable wireless communications. The wired network may include, but is not limited to: wide area network, metropolitan area network, local area network. The above is merely an example, and is not limited in any way in the present embodiment.
As an optional embodiment, the second application program with the screen throwing function installed at the mobile phone end obtains the IP address of the mobile phone, and after the two-dimensional code generated in the second application program installed at the PC end is scanned, the IP address of the PC end is obtained from the two-dimensional code. And then the mobile phone terminal sends a message to the background server, and informs the background server that the mobile phone terminal wants to establish connection with the PC terminal, wherein the message carries the IP address of the mobile phone terminal which wants to establish connection with the PC terminal.
The second terminal PC end is provided with a screen-throwing monitoring server, and the PC end can pull information from a background server to see which mobile phone ends try to be connected to the PC end at present when the monitoring server is started. If so, the IP address of the mobile phone end is obtained from the background server, and the reverse connection is initiated by the PC end.
And when the mobile phone starts the scanning screen-throwing function, a network monitoring port is also established, and the PC terminal is waited to be actively connected with the mobile phone terminal. The PC end is successfully connected to the network monitoring port established by the mobile phone end, and the network interaction process can follow the standard RTMP protocol after the RTMP handshake is passed.
As an alternative embodiment, after the first connection establishment request is sent to the second IP address on the first terminal, the method further comprises: and under the condition that the firewall on the second terminal refuses the first connection establishment request, determining that the first connection establishment fails. In this embodiment, the firewall is an information security system installed between the internet and the intranet in the field of computer science, and monitors the transmission to and from the enterprise according to a predetermined policy of the enterprise. The firewall may be a dedicated network device or run on the host to check for network traffic on each network interface. It is currently the most important type of network protection equipment, and from a professional perspective, a firewall is a set of hardware or software components located between two (or more) networks that perform inter-network access or control. Under the condition that the firewall of the PC terminal refuses the connection request initiated by the mobile phone terminal, the failure of establishing connection initiated by the mobile phone terminal to the PC terminal is determined. Specifically, the mobile phone end or the PC end determines that the connection establishment fails, after the mobile phone end scans the two-dimensional code, if the firewall of the PC end refuses the connection request initiated by the mobile phone end, the mobile phone end receives the connection refusing message sent by the PC end, and a prompt message of "connection failure" is displayed on the interface of the mobile phone end. After the mobile phone terminal scans the PC terminal, the PC terminal can acquire information requesting connection, if connection with the mobile phone terminal is not established within a preset time interval, the PC terminal determines that connection with the mobile phone terminal fails, and the preset time interval can be set according to practical conditions, for example, 30 seconds, 1 minute, 3 minutes or the like.
As an optional embodiment, the obtaining, at the first terminal, a second connection establishment request sent by the second terminal to the first IP address includes: a target monitoring task is established on the first terminal, wherein the target monitoring task is used for monitoring a connection establishment request sent to the first IP address; and monitoring the second connection establishment request through the target monitoring task on the first terminal. In this embodiment, when the mobile phone end sends a connection request to the PC end, a network monitoring task is established at the mobile phone end, and specifically, the mobile phone end may serve as a temporary monitoring server through a monitoring port. The identity of the PC end of the server is inverted, and the connection request is actively sent to the mobile phone end to connect with the port of the mobile phone end. And monitoring a connection request sent by the PC terminal through a monitoring task established by the mobile phone terminal.
As an optional embodiment, the establishing a target listening task on the first terminal includes: a first monitoring task is established on the first terminal, wherein the target monitoring task comprises the first monitoring task, and the first monitoring task is used for monitoring a connection establishment request sent to a target port of the first IP address; the step of monitoring, on the first terminal, the second connection establishment request through the target monitoring task includes: and monitoring the second connection establishment request sent by the second terminal to the target port of the first IP address through the first monitoring task on the first terminal. In this embodiment, a network monitoring port may be established at the mobile phone end, and serves as a temporary server, where a monitoring task is used to monitor a connection establishment request sent by the PC end to the port. As an alternative implementation manner, the mobile phone end obtains its own IP address, for example 192.168.1.200, while sending a connection request to the PC end, and then establishes a monitoring port, for example 1937, which serves as a temporary server of the mobile phone end, and is used for monitoring whether a terminal request for establishing a connection with the mobile phone end exists. And under the condition that the monitoring port of the mobile phone monitors that the PC end requests to establish connection with the mobile phone end, establishing connection with the PC end according to the IP address of the PC end.
As an optional embodiment, said establishing said second connection between said first terminal and said second terminal in response to said second connection establishment request comprises: and when the target port is a TCP port and the second connection establishment request is an RTMP connection establishment request, establishing an RTMP connection between the first terminal and the second terminal. In this embodiment, the real-time messaging protocol (Real Time Messaging Protocol, RTMP) is a protocol family based on TCP. RTMP is a network protocol used for real-time data communication, and is mainly used for audio-video and data communication. The monitoring port can be a TCP port, and under the condition that the monitoring port monitors the RTMP connection establishment request sent by the PC end, the mobile phone end does not have the firewall problem, so that the connection can be successfully established with the PC end.
As an alternative embodiment, after establishing the second connection between the first terminal and the second terminal in response to the second connection establishment request, the method further comprises: and transmitting, on the first terminal, screen information displayed on a screen of the first terminal to the second terminal through the second connection, wherein the screen information is used for displaying on the second terminal. In this embodiment, after the mobile phone end and the PC end successfully establish a connection, the content displayed on the current screen of the mobile phone end may be displayed on the screen of the PC end. The content displayed on the current screen of the mobile phone terminal can be an operating game interface or an audio/video playing. Taking live broadcasting as an example, the current screen of the mobile phone terminal displays a game interface as an example, in the game competition process, the game operation of the contestant is usually required to be displayed on the PC terminal in a live broadcasting mode, and a spectator can know the operation of the contestant in the game through a live broadcasting picture. The screen throwing function of the mobile phone and the PC terminal can show the game operation executed by the contestant at the mobile phone terminal on the PC terminal, however, in general, the firewall at the PC terminal can prevent the connection request sent by the mobile phone terminal, so that the mobile phone terminal cannot be successfully connected with the PC terminal. In this embodiment, after a second application program with a screen-throwing function is started at the mobile phone end, and the computer screen-throwing function is selected to scan the two-dimensional code in the first program with the screen-throwing function at the PC end, connection is requested to be established with the PC end, and under the condition that the connection request sent from the mobile phone end to the PC end fails to be established, the PC end reversely sends the connection request to the mobile phone end, and as the mobile phone end does not have the firewall problem, connection can be successfully established, and a game scene displayed in the screen of the mobile phone end can be displayed at the PC end through the established channel.
As an optional embodiment, before the obtaining, at the first terminal, a second connection establishment request sent by the second terminal to the first IP address, the method includes: acquiring the first IP address of the first terminal on the second terminal under the condition that the first connection establishment fails; and sending the second connection establishment request to the first IP address on the second terminal. In this embodiment, when the mobile phone initiates connection establishment to the PC, the PC reports its own IP address, and when the PC pulls that the mobile phone is in existence and the connection is not successful, the PC obtains the IP address of the mobile phone and reversely sends a request for establishing connection to the IP address of the mobile phone.
As an optional embodiment, said obtaining, at the second terminal, the first IP address of the first terminal includes: and acquiring the first IP address of the first terminal issued by a background server on the second terminal, wherein the first IP address in the background server is uploaded to the background server by the first terminal. In this embodiment, the mobile phone end may acquire its own IP address, and after the mobile phone end scans the two-dimensional code presented by the PC end, the IP address of the PC end is acquired from the two-dimensional code information. Meanwhile, the mobile phone end reports the IP address of the mobile phone end to the background server so as to inform the background server that the background server wants to establish connection with the PC end. In a preset time period after the mobile phone terminal scans the two-dimension code, the PC terminal finds that connection with the mobile phone is not established, at the moment, the PC terminal pulls information to a server to acquire an IP address of the mobile phone terminal which wants to be connected with the PC terminal, and sends a connection request to the IP address to request to establish connection with the mobile phone terminal.
Alternatively, as an alternative embodiment, the present application is described below by way of a specific example.
Taking live game as an example, assume that the local area network IP address of the mobile phone end is 192.168.1.200 and the local area network IP address of the pc end is 192.168.1.201.
The current interface of the mobile phone terminal displays a game interface as shown in fig. 7, and after the mobile phone terminal selects 'computer screen projection', the mobile phone terminal scans the two-dimensional code of the PC terminal by 'scanning the two-dimensional code'.
The handset establishes a TCP listening port, e.g., 1935. Then, the mobile phone end scans the two-dimension code of the PC end by scanning the two-dimension code, the IP address 192.168.1.201 of the PC end is obtained in the two-dimension code, and meanwhile, the mobile phone end reports the IP address 192.168.1.200 and the created monitoring port 1935 to the background server, so that the background server is informed that the mobile phone terminal with the IP address 192.168.1.200 wants to establish connection with the PC terminal with the IP address 192.168.1.201.
Under the condition that the firewall problem does not exist, as shown in fig. 8, after the interaction processes of C0/C1/C2/S1/S2 and the like are completed, RTMP handshake is formally completed, and the mobile phone end and the PC end are successfully connected, so that the PC end can receive picture data from the mobile phone end.
However, when the firewall problem exists at the PC end, the TCP packet sent by the mobile phone end cannot reach smoothly, so that the PC end does not receive any C0/C1/C2 packet, further the connection is overtime, and finally the connection fails, as shown in fig. 9.
In this embodiment, the PC side pulls information to the background server every predetermined time to see which handsets are currently attempting to establish a connection with the PC side. The PC terminal with the IP address 192.168.1.201 obtains the IP address 192.168.1.200 from the background server and wants to establish a connection with the mobile phone terminal. And the PC end detects that the connection is not established with the mobile phone end with the IP address within a preset time period, and then the PC end reversely sends a connection establishment request to the mobile phone end with the IP address of 192.168.1.200.
The mobile phone terminal monitors the connection request sent by the PC terminal through the established monitoring port 1937 port, as shown in fig. 10, since the mobile phone terminal has no firewall problem, the connection can be successfully established, and after the mobile phone terminal and the PC terminal successfully establish the connection, the content displayed in the current mobile phone interface can be live broadcast on the PC terminal.
In this embodiment, the mobile phone reads the IP address of the PC end in a code scanning manner, so as to initiate connection. The PC end initiates connection to the mobile phone end, and firstly obtains the IP address of the mobile phone. The specific solution is as follows:
firstly, the mobile phone end obtains the local IP, for example 192.168.1.200, then establishes an available port, for example 1937, scans the PC, and obtains the IP address 192.168.1.201 of the PC from the two-dimensional code information. The handset then invokes the background server informing the background 192.168.1.200 that it wants to establish a connection with 192.168.1.201 and that the listening port is 1937. The PC receives the information issued by the background server, and knows that one mobile phone wants to throw a screen, the IP address of the mobile phone is 192.168.1.200, and the monitored port is 1937, so that RTMP connection is actively initiated to 192.168.1.200:1937. And establishing RTMP connection, and then normally performing mobile phone screen-throwing service.
By adopting the scheme, the connection formation rate of the mobile phone screen is improved, the problem of connection failure caused by a firewall under the same local area is avoided, the firewall configuration step is also reduced in operation experience, the firewall configuration is conveniently avoided, the user experience is greatly improved, the workload of customer service and operation in the screen is reduced, and the user public praise is improved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present invention. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
According to another aspect of the embodiment of the present invention, there is also provided a connection establishment apparatus for a multi-terminal for implementing the connection establishment method for a multi-terminal. As shown in fig. 11, the apparatus includes:
a first obtaining module 1102, configured to obtain, at a first terminal, a second IP address of a second terminal; a sending module 1104, configured to send a first connection establishment request to the second IP address on the first terminal, where the first connection establishment request carries a first IP address of the first terminal, and the first connection establishment request is used to request establishment of a first connection between the first terminal and the second terminal; a second obtaining module 1106, configured to obtain, on the first terminal, a second connection establishment request sent by the second terminal to the first IP address, where the second connection establishment request is used to request that a second connection be established between the first terminal and the second terminal, where the first connection establishment fails; an establishing module 1108 is configured to establish the second connection between the first terminal and the second terminal in response to the second connection establishment request.
As an optional embodiment, the foregoing apparatus is further configured to determine, after the first connection establishment request is sent to the second IP address by the first terminal, that the first connection establishment fails if the firewall on the second terminal rejects the first connection establishment request.
As an optional embodiment, the above second obtaining module is further configured to obtain, on the first terminal, a second connection establishment request sent by the second terminal to the first IP address by: a target monitoring task is established on the first terminal, wherein the target monitoring task is used for monitoring a connection establishment request sent to the first IP address; and monitoring the second connection establishment request through the target monitoring task on the first terminal.
As an optional embodiment, the foregoing apparatus is configured to implement the establishing a target listening task on the first terminal by: a first monitoring task is established on the first terminal, wherein the target monitoring task comprises the first monitoring task, and the first monitoring task is used for monitoring a connection establishment request sent to a target port of the first IP address; the device is used for realizing that the first terminal monitors the second connection establishment request through the target monitoring task by the following modes: and monitoring the second connection establishment request sent by the second terminal to the target port of the first IP address through the first monitoring task on the first terminal.
As an optional embodiment, the above-mentioned establishing module is configured to implement the establishing the second connection between the first terminal and the second terminal in response to the second connection establishment request by: and when the target port is a TCP port and the second connection establishment request is an RTMP connection establishment request, establishing an RTMP connection between the first terminal and the second terminal.
As an optional embodiment, the above apparatus is further configured to, after the second connection between the first terminal and the second terminal is established in response to the second connection establishment request, transmit, on the first terminal, screen information displayed on a screen of the first terminal to the second terminal through the second connection, where the screen information is used for displaying on the second terminal.
As an optional embodiment, the foregoing apparatus is further configured to obtain, on the first terminal, the first IP address of the first terminal if the first connection establishment fails, before obtaining, on the first terminal, a second connection establishment request sent by the second terminal to the first IP address; and sending the second connection establishment request to the first IP address on the second terminal.
As an optional embodiment, the foregoing apparatus is further configured to obtain, at the second terminal, the first IP address of the first terminal by: and acquiring the first IP address of the first terminal issued by a background server on the second terminal, wherein the first IP address in the background server is uploaded to the background server by the first terminal.
According to a further aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the above-mentioned multi-terminal connection establishment method, as shown in fig. 12, the electronic device comprising a memory 1202 and a processor 1204, the memory 1202 storing a computer program, the processor 1204 being arranged to execute the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, acquiring a second IP address of a second terminal on a first terminal;
s2, a first connection establishment request is sent to the second IP address on the first terminal, wherein the first connection establishment request carries the first IP address of the first terminal, and the first connection establishment request is used for requesting to establish a first connection between the first terminal and the second terminal;
s3, under the condition that the first connection establishment fails, acquiring a second connection establishment request sent by the second terminal to the first IP address on the first terminal, wherein the second connection establishment request is used for requesting to establish a second connection between the first terminal and the second terminal;
s4, responding to the second connection establishment request, and establishing the second connection between the first terminal and the second terminal.
Alternatively, it will be understood by those skilled in the art that the structure shown in fig. 12 is only schematic, and the electronic device may also be a terminal device such as a smart phone (e.g. an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a mobile internet device (Mobile Internet Devices, MID), a PAD, etc. Fig. 12 is not limited to the structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 12, or have a different configuration than shown in FIG. 12.
The memory 1202 may be configured to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for establishing a multi-terminal connection in the embodiment of the present invention, and the processor 1204 executes the software programs and modules stored in the memory 1202 to perform various functional applications and data processing, that is, to implement the method for establishing a multi-terminal connection described above. Memory 1202 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1202 may further include memory located remotely from the processor 1204, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Optionally, the transmission device 1206 is configured to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission means 1206 comprises a network adapter (Network Interface Controller, NIC) that can be connected to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 1206 is a Radio Frequency (RF) module for communicating wirelessly with the internet.
In addition, the electronic device further includes: a display 1208 for displaying the first connection establishment request or the second connection establishment request; and a connection bus 1210 for connecting the respective module parts in the above-described electronic device.
According to a further aspect of embodiments of the present invention, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described computer-readable storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring a second IP address of a second terminal on a first terminal;
s2, a first connection establishment request is sent to the second IP address on the first terminal, wherein the first connection establishment request carries the first IP address of the first terminal, and the first connection establishment request is used for requesting to establish a first connection between the first terminal and the second terminal;
s3, under the condition that the first connection establishment fails, acquiring a second connection establishment request sent by the second terminal to the first IP address on the first terminal, wherein the second connection establishment request is used for requesting to establish a second connection between the first terminal and the second terminal;
s4, responding to the second connection establishment request, and establishing the second connection between the first terminal and the second terminal.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method described in the embodiments of the present invention.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (8)

1. A method for establishing a connection between multiple terminals, comprising:
acquiring a first IP address of a first terminal on the first terminal;
acquiring a second IP address of a second terminal provided with a firewall from the first terminal;
reporting the first IP address to a background server on the first terminal;
transmitting a first connection establishment request to the second IP address on the first terminal, wherein the first connection establishment request is used for requesting to establish a first connection between the first terminal and the second terminal;
acquiring a second connection establishment request sent by the second terminal to the first IP address on the first terminal under the condition that the firewall refuses the first connection establishment request, wherein before the second terminal sends the second connection request to the first IP address, the second terminal acquires the first IP address issued by the background server, and the second connection establishment request is used for requesting to establish a second connection between the first terminal and the second terminal;
and establishing the second connection between the first terminal and the second terminal in response to the second connection establishment request.
2. The method according to claim 1, wherein the obtaining, at the first terminal, a second connection establishment request sent by the second terminal to the first IP address, comprises:
a target monitoring task is established on the first terminal, wherein the target monitoring task is used for monitoring a connection establishment request sent to the first IP address;
and monitoring the second connection establishment request through the target monitoring task on the first terminal.
3. The method of claim 2, wherein the step of determining the position of the substrate comprises,
the establishing a target monitoring task on the first terminal comprises the following steps: a first monitoring task is established on the first terminal, wherein the target monitoring task comprises the first monitoring task, and the first monitoring task is used for monitoring a connection establishment request sent to a target port of the first IP address;
the step of monitoring, on the first terminal, the second connection establishment request through the target monitoring task includes: and monitoring the second connection establishment request sent by the second terminal to the target port of the first IP address through the first monitoring task on the first terminal.
4. A method according to claim 3, wherein said establishing said second connection between said first terminal and said second terminal in response to said second connection establishment request comprises:
and when the target port is a TCP port and the second connection establishment request is an RTMP connection establishment request, establishing an RTMP connection between the first terminal and the second terminal.
5. The method according to any of claims 1 to 4, wherein after establishing the second connection between the first terminal and the second terminal in response to the second connection establishment request, the method further comprises:
and transmitting, on the first terminal, screen information displayed on a screen of the first terminal to the second terminal through the second connection, wherein the screen information is used for displaying on the second terminal.
6. The method according to any of claims 1 to 4, characterized in that before said obtaining, at the first terminal, a second connection establishment request sent by the second terminal to the first IP address, it comprises:
acquiring the first IP address of the first terminal on the second terminal under the condition that the first connection establishment fails;
and sending the second connection establishment request to the first IP address on the second terminal.
7. A multi-terminal connection establishment apparatus, comprising:
the device is used for acquiring a first IP address of a first terminal on the first terminal;
a first obtaining module, configured to obtain, on the first terminal, a second IP address of a second terminal provided with a firewall;
the device is further used for reporting the first IP address to a background server on the first terminal;
a sending module, configured to send a first connection establishment request to the second IP address on the first terminal, where the first connection establishment request is used to request establishment of a first connection between the first terminal and the second terminal;
a second obtaining module, configured to obtain, on the first terminal, a second connection establishment request sent by the second terminal to the first IP address, where the second terminal obtains, before the second terminal sends, to the first IP address, the first IP address issued by the background server, where the second connection establishment request is used to request establishment of a second connection between the first terminal and the second terminal;
and the establishing module is used for responding to the second connection establishing request and establishing the second connection between the first terminal and the second terminal.
8. A computer readable storage medium comprising a stored program, wherein the program is arranged to perform the method of any of the preceding claims 1 to 7 when run by a computer device.
CN201911296679.2A 2019-12-16 2019-12-16 Multi-terminal connection establishment method and device, storage medium and electronic device Active CN110809330B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911296679.2A CN110809330B (en) 2019-12-16 2019-12-16 Multi-terminal connection establishment method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911296679.2A CN110809330B (en) 2019-12-16 2019-12-16 Multi-terminal connection establishment method and device, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN110809330A CN110809330A (en) 2020-02-18
CN110809330B true CN110809330B (en) 2023-07-14

Family

ID=69493377

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911296679.2A Active CN110809330B (en) 2019-12-16 2019-12-16 Multi-terminal connection establishment method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN110809330B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101834783A (en) * 2010-03-29 2010-09-15 北京星网锐捷网络技术有限公司 Method and device for forwarding messages and network equipment
CN103858382A (en) * 2011-09-08 2014-06-11 迈可菲公司 Application state sharing in a firewall cluster
CN104702587A (en) * 2013-12-04 2015-06-10 柯尼卡美能达株式会社 Relay device, image forming apparatus and relay method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105991386B (en) * 2015-01-28 2020-04-07 阿里巴巴集团控股有限公司 Method, device and system for connecting computer and terminal
JP6655921B2 (en) * 2015-09-11 2020-03-04 キヤノン株式会社 Communication system and control method thereof, image forming apparatus and control method thereof, and program
CN110177399A (en) * 2019-04-30 2019-08-27 深圳市鹰硕技术有限公司 One kind is the same as screen method for connecting network, device, smart machine and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101834783A (en) * 2010-03-29 2010-09-15 北京星网锐捷网络技术有限公司 Method and device for forwarding messages and network equipment
CN103858382A (en) * 2011-09-08 2014-06-11 迈可菲公司 Application state sharing in a firewall cluster
CN104702587A (en) * 2013-12-04 2015-06-10 柯尼卡美能达株式会社 Relay device, image forming apparatus and relay method

Also Published As

Publication number Publication date
CN110809330A (en) 2020-02-18

Similar Documents

Publication Publication Date Title
US11902255B2 (en) Systems and methods for delivering messages over a network
WO2020042321A1 (en) Method, apparartus and system for controlling projection screen
CN100587681C (en) System and method for communicating images between intercommunicating users
EP3640849B1 (en) Electronic device and method of registering personal cloud apparatus in user portal server thereof
CN110881144B (en) Data processing method based on live broadcast platform and related equipment
US10986386B2 (en) Video monitoring method and device, storage medium, and electronic device
CN111427527B (en) Screen projection method, device, equipment and computer readable storage medium
CN111565137A (en) System and method for binding WiFi distribution network and equipment
WO2017215614A1 (en) Method, device and system for realising heart beat keepalive
US10165229B2 (en) Network communication system and method thereof
US20160198235A1 (en) Message Processing Method, Device, Gateway, STB and IPTV
WO2013126464A1 (en) Transferring of communication event
EP1921817A1 (en) Methods and a device for associating a first device with a second device
CN106412498B (en) monitoring data acquisition method and cloud terminal
CN103634172A (en) Method, device and system for processing multi-terminal cooperation information
US11665132B2 (en) Client-server connections over wide area network
CN105681385A (en) Information pushing method and device
US20160262206A1 (en) Communication system, communication method, relay device, and computer program product
CN109819278B (en) Optimization method of live video
CN115664989A (en) Monitoring system and method of cloud desktop
CN110809330B (en) Multi-terminal connection establishment method and device, storage medium and electronic device
CN112492109B (en) Communication method, device and system
EP2672667A2 (en) Method and system for implementing ip-based vvm
WO2023011021A1 (en) Live picture display method and apparatus, storage medium, and electronic device
CN116567342A (en) Screen projection method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40022293

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant