CN110691110A - Communication method, device, system, terminal, equipment and medium - Google Patents
Communication method, device, system, terminal, equipment and medium Download PDFInfo
- Publication number
- CN110691110A CN110691110A CN201810736581.3A CN201810736581A CN110691110A CN 110691110 A CN110691110 A CN 110691110A CN 201810736581 A CN201810736581 A CN 201810736581A CN 110691110 A CN110691110 A CN 110691110A
- Authority
- CN
- China
- Prior art keywords
- terminal
- port number
- sent
- address
- server
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
- H04L67/025—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/164—Adaptation or special uses of UDP protocol
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention provides a communication method, a device, a system, a terminal, equipment and a medium, which are applied to the technical field of communication, wherein the method comprises the following steps: receiving a first connection request which is sent by a terminal and establishes connection with a remote controlled device, wherein the first connection request carries identification information of the remote controlled device; and establishing a UDP channel for the terminal and the remote control device according to the first connection request, and sending the IP address and the port number of the UDP channel to the terminal and the remote control device to enable the terminal and the remote control device to communicate based on the IP address and the port number. Because the P2P server can adopt the mode of fixed IP distribution port number based on P2P technology, establish UDP channel for terminal and remote control equipment, so the terminal and remote control equipment can directly communicate through the UDP channel, overcome the problem that the information interaction is fussy and the real-time is poor in the controlled process of the electronic equipment in the prior art.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a communication method, apparatus, system, terminal, device, and medium.
Background
In the mobile interconnection era, intelligent hardware has unlimited prospects, and the intelligent hardware is as small as a bulb, a camera, a health scale and a sound box and as large as an electric cooker, a washing machine, a microwave oven and an air purifier. Especially, the intelligent sound box is taken as a representative and is used as a control center of an intelligent hardware family scene, and the real-time interactive experience of the intelligent sound box is particularly important.
At present, the control scenes of the intelligent sound box include two kinds, one is a close scene, namely, the sound box is near the user, and the user remotely controls the sound box in a close range; the other is a distant scene, namely, the sound box is not beside the user, and the sound box is remotely controlled.
In a close-range scene, a user can control through a terminal APP (Application) or bluetooth.
When the Control is performed through the terminal APP, data communication needs to be realized in a mode of bridging among servers, that is, as shown in fig. 1, the intelligent audio maintains data communication with the service server in a mode of long connection through a TCP (Transmission Control Protocol), and the APP sends a command to the service server in a mode of a HTTP (hypertext transfer Protocol) through the terminal where the APP is located, and then is issued to the intelligent audio by the server. Similarly, the real-time status and information of the smart audio needs to be transferred through the server before being sent to the terminal. Therefore, the problems of complicated information interaction process and poor real-time performance exist.
When control is performed through bluetooth, as shown in fig. 2, the smart audio and the terminal are connected to each other, so that information interaction can be performed through a bluetooth transmission band. However, the bluetooth transmission band is unstable, and the bluetooth connection distance is limited, so that the problem of poor real-time performance also exists.
Therefore, how to solve the problems of complicated information interaction and poor real-time performance in the controlled process of the electronic equipment in the prior art is a problem to be considered.
Disclosure of Invention
The invention discloses a communication method, a communication device, a communication system, a communication terminal, communication equipment and a communication medium, which are used for solving the problems of complicated information interaction and poor real-time performance when electronic equipment is controlled in the prior art.
To achieve the above object, according to an aspect of the present invention, there is provided a communication method including:
receiving a first connection request which is sent by a terminal and establishes connection with a remote controlled device, wherein the first connection request carries identification information of the remote controlled device;
and establishing a User Data Protocol (UDP) channel for the terminal and the remote control device according to the first connection request, and sending an IP address and a port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number.
As can be seen from the above, after receiving a first connection request sent by a terminal and establishing a connection with a remote controlled device, a P2P server may determine a corresponding remote controlled terminal according to identification information of the remote controlled device carried in the first connection request, and establish a UDP channel for the terminal and the corresponding remote controlled device by using a mode of allocating a port number through a fixed IP based on the P2P technology, so as to implement direct communication between the terminal and the remote controlled device based on an IP address and a port number of the UDP channel, thereby overcoming the problems of cumbersome information interaction and poor real-time performance existing in the controlled process of an electronic device in the prior art.
Specifically, before the receiving terminal sends a first connection request for establishing a connection with a remote controlled device, the method further includes:
receiving a first registration request sent by the terminal and a second registration request sent by the remote control device, wherein the first registration request carries identification information of the terminal, and the second registration request carries identification information of the remote control device;
sending the identification information of the terminal and the remotely controlled equipment to a service server, so that the service server verifies whether the terminal and the remotely controlled equipment are legal or not;
and if the verification passing information sent by the service server is received, executing the subsequent steps.
Since the network accessed by the P2P server is a public network and the network accessed by the terminal and the remote control device is a private network, in order to ensure that the terminal and the remote control device which penetrate through the public network accessed by the P2P server are both legal devices, before establishing a UDP channel for the terminal and the remote control device, the P2P server firstly sends the identification information carried in the registration information of the terminal and the remote control device to the service server, and verifies whether the terminal and the remote control device are legal or not according to the identification information by the service server, so as to ensure network security and communication security.
Specifically, after establishing a UDP channel for the terminal and the remote controlled device according to the first connection request, the method further includes:
monitoring heartbeat packets sent by the terminal and the remotely controlled equipment, wherein the heartbeat packets carry verification information of corresponding equipment;
and if the heartbeat packet is not monitored or the verification information in the monitored heartbeat packet is invalid, disconnecting the DUP channel between the terminal and the remote control device.
In order to ensure that the P2P server can track the states of the terminal and the remote-controlled device, the P2P server monitors heartbeat packets sent by the terminal and the remote-controlled device, and when the P2P server does not monitor the heartbeat packets or verification information carried in the monitored heartbeat packets is invalid, a DUP channel between the terminal and the remote-controlled device is automatically disconnected, so that network security and communication security are further ensured.
According to another aspect of the present invention, there is also provided a communication method, including:
sending a first connection request for establishing connection with a remote-controlled device to a P2P server, so that the P2P server establishes a UDP channel for the terminal and the remote-controlled device, wherein the first connection request carries identification information of the remote-controlled device;
and receiving the IP address and the port number of the UDP channel sent by the P2P server, and communicating with the remote control device based on the IP address and the port number.
It can be seen from the above that, by sending the first connection request for establishing connection with the remote controlled device to the P2P server, the P2P server can determine the corresponding remote controlled terminal according to the identification information of the remote controlled device carried in the first connection request, and establish a UDP channel for the terminal and the corresponding remote controlled device by using a mode of allocating a port number by using a fixed IP based on the P2P technology, so that the terminal can directly communicate with the remote controlled device by using the IP address and the port number of the UDP channel, thereby overcoming the problems of cumbersome information interaction and poor real-time performance existing in the controlled process of the electronic device in the prior art.
Wherein before sending the first connection request for establishing connection with the remote controlled device to the P2P server, the method further comprises:
and sending a first registration request to the P2P server, wherein the first registration request carries the identification information of the terminal, so that the P2P server sends the identification information of the terminal to a service server, and the service server verifies whether the terminal is legal or not.
That is to say, before sending the first connection request to the P2P server, the terminal needs to send a registration request to the P2P server, so that the P2P server sends the identification information carried in the registration request to the service server, and the service server verifies whether the terminal is a valid user, so as to ensure network security and communication security.
Specifically, if the IP address and the port number of the UDP channel sent by the P2P server are not received within a first preset time period, the method further includes:
sending a second connection request for establishing connection with the remote control device to a service server;
receiving a preset random algorithm sent by the service server, wherein the preset random algorithm is sent by the service server after the IP address and the port number sent by the remotely controlled equipment are received;
determining a first predicted port number of the UDP channel according to the preset random algorithm, and sending the first predicted port number to the service server, so that the service server checks whether the first predicted port number is correct according to the port number of the UDP channel sent by the remote control device;
and if first verification passing information sent by the service server is received, wherein the first verification information carries the IP address of the UDP channel, communicating with the remote control device based on the IP address and a first predicted port number.
When the terminal does not receive the IP address and the port number of the UDP channel sent by the P2P server, the terminal is not connected to the public network accessed by the P2P server in a penetrating way, at the moment, the terminal sends a second connection request to the service server, if the service server receives the IP address and the port number sent by the remote control device, the remote control device is connected to the public network accessed by the P2P server in a penetrating way, so the service server sends a preset random algorithm to the terminal after receiving the second connection request, the terminal determines a first predicted port number of the UDP channel by adopting a port guessing way according to the preset random algorithm, and when the first predicted port number is verified to be correct, the service server sends first verification passing information carrying the IP address of the UDP channel to the terminal, so that the terminal can directly communicate with the remote control device based on the IP address and the first predicted port number, therefore, the terminal can automatically establish a UDP channel with the remote control device under the condition that the terminal is not connected with the public network accessed by the P2P server in a penetrating way, and the remote control device is connected with the public network accessed by the P2P server in a penetrating way.
Specifically, the method further comprises:
sending control signaling to the remote controlled device based on the UDP channel;
if the response message sent by the remote control device is not received within a second preset time span, sending the second connection request to a service server, so that the service server sends a preset random algorithm to the remote control device;
and if second check-up passing information sent by the service server is received, communicating with the remote-controlled equipment based on the IP address and the port number of the UDP channel, wherein the second check-up passing information is sent when the service server checks up the second predicted port number of the UDP channel established by the P2P server according to the preset random algorithm to the remote-controlled equipment according to the port number of the UDP channel sent by the terminal.
If the terminal can send a control instruction to the remote control device based on the UDP channel but does not receive response information returned by the remote control device, the terminal can penetrate through the public network accessed by the P2P server and the remote control device does not penetrate through the public network accessed by the P2P server, at this time, the terminal sends a second connection request to the service server, so that the service server sends a preset random algorithm to the corresponding remote control device according to the identification information carried in the second connection request, so that the remote control device determines a second predicted port number of the UDP channel by adopting a port guess mode according to the preset random algorithm, and the service server sends second verification passing information to the terminal when the second predicted port number is verified to be correct, so that the terminal can directly communicate with the remote control device based on the IP address and the port number of the UDP channel, the remote control device is enabled to automatically establish a UDP channel with the terminal under the condition that the terminal can penetrate through the public network connected to the P2P server and the remote control device is not penetrated through the public network connected to the P2P server.
According to another aspect of the present invention, there is also provided a communication method, including:
and receiving the IP address and the port number of the UDP channel sent by the P2P server, and communicating with the terminal based on the IP address and the port number.
By receiving the IP address and the port number of the UDP channel sent by the P2P server, the remote control device can directly communicate with the terminal through the IP address and the port number of the UDP channel, so that the problems of complicated information interaction and poor real-time performance existing in the controlled process of the electronic device in the prior art are solved.
Specifically, before receiving the IP address and the port number of the UDP channel sent by the P2P server, the method further includes:
and sending a second registration request to the P2P server, wherein the second registration request carries the identification information of the remote controlled device, so that the P2P server sends the identification information of the remote controlled device to a service server, and the service server verifies whether the remote controlled device is legal or not.
That is, before the remote controlled device communicates with the terminal based on the IP address and the port number of the UDP channel sent by the P2P server, the remote controlled device needs to send a registration request to the P2P server, so that the P2P server sends the identification information in the registration request to the service server, and the service server verifies whether the remote controlled device is a valid user, so as to ensure network security and communication security.
Specifically, the method further comprises:
receiving a preset random algorithm sent by a service server;
determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to the service server, so that the service server checks whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal;
and if second check-up passing information sent by the service server is received, wherein the second check-up information carries the IP address of the UDP channel, communicating with the terminal based on the IP address and a second predicted port number.
That is, if the remote controlled device receives the preset random algorithm sent by the service server, it indicates that the terminal can penetrate the public network connected to the P2P server at this time, and the remote controlled device does not penetrate the public network accessed by the P2P server, the remote controlled device determines the second predicted port number of the UDP channel by adopting a port guess mode according to the preset random algorithm, if the second predicted port number is correct, the remotely controlled device receives the second check-up passing information sent by the service server, so that the remote control equipment can directly communicate with the terminal based on the IP address of the UDP channel and the second predicted port number, realize that the terminal is connected to the public network accessed by the P2P server through, and under the condition that the remote control device is not connected to the public network accessed by the P2P server in a penetrating way, the remote control device is enabled to automatically establish a UDP channel with the terminal.
According to another aspect of the present invention, there is also provided an electronic apparatus, including: a processor, a memory, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: receiving a first connection request which is sent by a terminal and is used for establishing connection with a remote-controlled device through the transceiver, wherein the first connection request carries identification information of the remote-controlled device; according to the first connection request, establishing a UDP (user Datagram protocol) channel for the terminal and the remote control device, and sending an IP address and a port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number;
the transceiver is used for receiving and transmitting data under the control of the processor.
Specifically, the processor is further configured to receive, by the transceiver, a first registration request sent by a terminal and a second registration request sent by a remote controlled device before receiving a first connection request sent by the terminal to establish a connection with the remote controlled device, where the first registration request carries identification information of the terminal, and the second registration request carries identification information of the remote controlled device; sending the identification information of the terminal and the remotely controlled equipment to a service server, so that the service server verifies whether the terminal and the remotely controlled equipment are legal or not; and if the verification passing information sent by the service server is received, executing the subsequent steps.
Specifically, the processor is further configured to monitor a heartbeat packet sent by the terminal and the remotely controlled device after establishing a UDP channel for the terminal and the remotely controlled device according to the first connection request, where the heartbeat packet carries verification information of a corresponding device; and if the heartbeat packet is not monitored or the verification information in the monitored heartbeat packet is invalid, disconnecting the DUP channel between the terminal and the remote control device.
According to another aspect of the present invention, there is also provided a terminal, including: a processor, a memory, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: sending a first connection request for establishing connection with a remote controlled device to a P2P server through the transceiver, so that the P2P server establishes a UDP channel for the terminal and the remote controlled device, wherein the first connection request carries identification information of the remote controlled device; receiving an IP address and a port number of a UDP channel sent by the P2P server, and communicating with the remote control device based on the IP address and the port number;
the transceiver is used for receiving and transmitting data under the control of the processor.
Specifically, the processor is further configured to send a first registration request to the P2P server through the transceiver before sending a first connection request for establishing a connection with a remote controlled device to the P2P server, where the first registration request carries identification information of the terminal, so that the P2P server sends the identification information of the terminal to a service server, and the service server verifies whether the terminal is legal.
Specifically, the processor is further configured to send, to a service server through the transceiver, a second connection request for establishing a connection with the remotely controlled device if the IP address and the port number of the UDP channel sent by the P2P server are not received within a first preset time period; receiving a preset random algorithm sent by the service server, wherein the preset random algorithm is sent by the service server after the IP address and the port number sent by the remotely controlled equipment are received; determining a first predicted port number of the UDP channel according to the preset random algorithm, and sending the first predicted port number to the service server, so that the service server checks whether the first predicted port number is correct according to the port number of the UDP channel sent by the remote control device; and if first verification passing information sent by the service server is received, wherein the first verification information carries the IP address of the UDP channel, communicating with the remote control device based on the IP address and a first predicted port number.
Specifically, the processor is further configured to send, by the transceiver, control signaling to the remotely controlled device based on the UDP channel; if the response message sent by the remote control device is not received within a second preset time span, sending the second connection request to a service server, so that the service server sends a preset random algorithm to the remote control device; and if second check-up passing information sent by the service server is received, communicating with the remote-controlled equipment based on the IP address and the port number of the UDP channel, wherein the second check-up passing information is sent when the service server checks up the second predicted port number of the UDP channel established by the P2P server according to the preset random algorithm to the remote-controlled equipment according to the port number of the UDP channel sent by the terminal.
According to another aspect of the present invention, there is also provided an electronic apparatus, including: a processor, a memory, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: receiving, by the transceiver, an IP address and a port number of a UDP channel transmitted by the P2P server, and communicating with the terminal based on the IP address and the port number;
the transceiver is used for receiving and transmitting data under the control of the processor.
Specifically, the processor is further configured to send, by the transceiver, a second registration request to the P2P server before receiving the IP address and the port number of the UDP channel sent by the P2P server, where the second registration request carries identification information of the remote controlled device, so that the P2P server sends the identification information of the remote controlled device to a service server, and the service server verifies whether the remote controlled device is legal.
Specifically, the processor is further configured to receive, by the transceiver, a preset random algorithm sent by the service server; determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to the service server, so that the service server checks whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal; and if second check-up passing information sent by the service server is received, wherein the second check-up information carries the IP address of the UDP channel, communicating with the terminal based on the IP address and a second predicted port number.
According to another aspect of the present invention, there is also provided a communication system including an electronic device applied to the P2P server, a terminal, and an electronic device applied to a remotely controlled device.
According to another aspect of the present invention, there is also provided a communication apparatus, including:
the remote control device comprises a first receiving module, a second receiving module and a third receiving module, wherein the first receiving module is used for receiving a first connection request which is sent by a terminal and establishes connection with a remote controlled device, and the first connection request carries identification information of the remote controlled device;
and the establishing module is used for establishing a UDP (user Datagram protocol) channel for the terminal and the remote control device according to the first connection request, and sending the IP address and the port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number.
According to another aspect of the present invention, there is also provided a communication apparatus, including:
a first sending module, configured to send a first connection request for establishing a connection with a remote controlled device to a P2P server, so that the P2P server establishes a UDP channel for the terminal and the remote controlled device, where the first connection request carries identification information of the remote controlled device;
and the communication module is used for receiving the IP address and the port number of the UDP channel sent by the P2P server and communicating with the remote control device based on the IP address and the port number.
According to another aspect of the present invention, there is also provided a communication apparatus, including:
the first receiving module is used for receiving the IP address and the port number of the UDP channel sent by the P2P server;
and the communication module is used for communicating with the terminal based on the IP address and the port number.
According to another aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program executable by an electronic device, the program, when run on the electronic device, causing the electronic device to perform the steps of the above-mentioned communication method.
According to another aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program executable by an electronic device, the program, when run on the electronic device, causing the electronic device to perform the steps of the above-mentioned communication method.
According to another aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program executable by an electronic device, the program, when run on the electronic device, causing the electronic device to perform the steps of the above-mentioned communication method.
The invention has the following beneficial effects:
the invention provides a communication method, a device, a system, a terminal, equipment and a medium, wherein the communication method comprises the following steps: receiving a first connection request which is sent by a terminal and establishes connection with a remote controlled device, wherein the first connection request carries identification information of the remote controlled device; and establishing a UDP (user Datagram protocol) channel for the terminal and the remote control device according to the first connection request, and sending an IP address and a port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number. In the invention, when a P2P server receives a first connection request sent by a terminal and establishing connection with a remote controlled device, the corresponding remote controlled device can be determined according to identification information of the remote controlled device carried in the first connection request, and a UDP channel is established for the terminal and the corresponding remote controlled device by adopting a mode of allocating a port number by a fixed IP based on a P2P technology, so as to realize direct communication between the terminal and the remote controlled device based on the IP address and the port number of the UDP channel, thereby overcoming the problems of complicated information interaction and poor real-time performance existing in the prior art when the remote controlled device is controlled.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of a terminal APP controlling a smart sound box in the prior art;
FIG. 2 is a schematic diagram of a Bluetooth controlled smart speaker in the prior art;
fig. 3 is a process diagram of a communication method according to a first embodiment of the present invention;
fig. 4 is a schematic diagram of a process of registering a terminal and a remote controlled device according to a second embodiment of the present invention;
fig. 5 is a schematic diagram of a process of actively establishing a UDP channel by a terminal according to a third embodiment of the present invention;
fig. 6 is a schematic diagram of a process of actively establishing a UDP channel by a remote controlled terminal according to a fourth embodiment of the present invention;
fig. 7 is a schematic diagram illustrating registration of a terminal and a remote controlled device according to a fifth embodiment of the present invention;
fig. 8 is a schematic diagram of establishing a UDP channel according to a fifth embodiment of the present invention;
fig. 9 is an electronic device according to an eighth embodiment of the present invention;
fig. 10 is a terminal according to a ninth embodiment of the present invention;
fig. 11 is an electronic device provided in a tenth embodiment of the present invention;
fig. 12 is a communication apparatus according to an eleventh embodiment of the present invention;
fig. 13 is a communication apparatus according to a twelfth embodiment of the present invention;
fig. 14 is a communication apparatus according to a thirteenth embodiment of the present invention;
fig. 15 is an electronic device provided in a fourteenth embodiment of the present invention;
fig. 16 is an electronic device according to a sixteenth embodiment of the present invention;
fig. 17 is an electronic device provided in eighteen embodiments of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
because in the prior art in the process of controlling some intelligent electronic devices through terminal APP or bluetooth, there are the loaded down with trivial details, the relatively poor problem of real-time nature of information interaction.
Therefore, in order to overcome the above technical problem, an embodiment of the present invention provides a communication method, and fig. 3 is a schematic process diagram of a communication method provided in an embodiment of the present invention, where the process includes the following steps:
step S301: the terminal sends a first connection request for establishing connection with the remote-controlled equipment to the P2P server, so that the P2P server establishes UDP channels for the terminal and the remote-controlled equipment.
Wherein, the first connection request carries the identification information of the remote controlled device.
Step S302: the P2P server receives a first connection request sent by the terminal to establish connection with the remote control device.
Since the first connection request carries the identification information of the remote controlled device, the P2P server can determine the corresponding remote controlled device to which the terminal wants to establish a connection according to the identification information of the remote controlled device.
Step S303: and the P2P server establishes a UDP channel for the terminal and the remote control device according to the first connection request, and sends the IP address and the port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number.
Step S304: and the terminal receives the IP address and the port number of the UDP channel sent by the P2P server and communicates with the remote control device based on the IP address and the port number.
Step S305: the remote controlled device receives the IP address and the port number of the UDP channel sent by the P2P server and communicates with the terminal based on the IP address and the port number.
It should be noted that, in the embodiment of the present invention, the network accessed by the P2P server is a public network, such as aristoloc, amazon, and the like, the network accessed by the terminal and the remote controlled device is a private network, and the terminal and the remote controlled device need to have a capability of accessing the public network. Because the private network IP can be directly communicated, the terminal and the remote control device can convert the private network IP address corresponding to the terminal and the remote control device into the public network IP through the network address translation NAT technology supported by the router, so that the terminal and the remote control device can be connected to the public network accessed by the P2P server in a penetrating manner.
Since the P2P is a peer-to-peer network, in the P2P network environment, the electronic devices connected to each other are all in a peer-to-peer status, so that when the terminal and the remote controlled device penetrate the public network accessed by the P2P server, the terminal and the remote controlled device communicate directly.
Specifically, when establishing a UDP channel for the terminal and the remote controlled device, the P2P server may use a mode in which a fixed IP allocates port numbers, where the fixed IP may be a public network IP obtained by converting a private network IP of the terminal through an NAT technique, or may be a public network IP obtained by converting a private network IP of the remote controlled device through an NAT technique. Since a router or an IP address can be provided with a plurality of devices, in order to ensure the uniqueness of the UDP channel used for communication between the terminal and the remote controlled device, a port number can be allocated to the UDP channel, wherein the port number is randomly generated by the P2P server through a preset random algorithm, so that the communication security of the UDP channel can be improved.
For example, the private network IP corresponding to the terminal is 192.168.1.101, and the public network IP converted by the router NAT technology is 120.78.201.201, so the record in the IP port mapping table on the router connected to the terminal is: [ 120.78.201.201 ] to [ 192.168.1.101 ]. The private network IP corresponding to the remote controlled device is 192.168.2.202, and the public network IP converted by the router NAT technology is 120.78.202.202, then the record in the IP port mapping table on the router connected to the remote controlled device is: [ 120.78.202.202 ] to [ 192.168.2.202 ].
When the P2P server receives a first connection request sent by the terminal to establish a connection with the remote controlled device, it determines the corresponding remote controlled device according to the identification information of the remote controlled device carried in the first connection request, and generates a random port number, for example 2020, by using a preset random algorithm. Then the UDP channels established by the P2P server for the terminal and the remotely controlled device may be 120.78.201.201: 2020, or 120.78.202.202: 2020.
if the IP address and the port number corresponding to the UDP channel established by the P2P server for the terminal and the remote control device are 120.78.201.201: 2020, after receiving the IP address and port number sent by the P2P server, the terminal adds one to the record in the IP port mapping table of its corresponding router: [ 120.78.201.201: 2020- [ 192.168.1.101 ], after receiving the IP address and the port number sent by the P2P server, the remote controlled device adds a record in the mapping table of the IP port of the corresponding router: [ 120.78.202.202: 2020- [ 192.168.2.202 ].
Therefore, when the terminal and the remote controlled device perform information interaction, the path of the information sent by the terminal is as follows: 192.168.1.101-120.78.201.201: 2020, the path of the received information is: 120.78.201.201: 2020-192.168.1.101. Similarly, the path of the information sent by the remote control device is as follows: 192.168.2.202-120.78.201.201: 2020, the path of the received information is: 120.78.201.201: 2020-192.168.2.202. Thus, the terminal and the remotely controlled device can be connected based on the UDP channel 120.78.201.201: 2020 enable direct communication.
Therefore, in the embodiment of the present invention, a UDP channel is established between the terminal and the corresponding remote controlled device by using a mode of allocating a port number through a P2P server based on a P2P technology, so that the terminal and the remote controlled device can directly communicate based on an IP address and a port number of the UDP channel, and therefore, forwarding through a service server is not required, and time for information interaction can be greatly shortened, thereby overcoming the problem of tedious signal interaction in a controlled process of an electronic device in the prior art.
It should be noted that there are three ways to implement NAT currently, namely Static NAT, Dynamic NAT, and port multiplex Over Load. The commonly used NAT traversal method for UDP channels mainly includes: the UDP of the NAT simply traverses STUN, the true traversal mode TURN of the NAT, and the like, which are not particularly limited in the embodiment of the present invention.
Example two:
to ensure network security and communication security during communication, on the basis of the above embodiment, in an embodiment of the present invention, before sending the first connection request for establishing connection with the remote controlled device to the P2P server, as shown in fig. 4, the communication method further includes:
step S401: the terminal sends a first registration request to the P2P server, wherein the first registration request carries the identification information of the terminal, so that the P2P server sends the identification information of the terminal to a service server, and the service server verifies whether the terminal is legal or not.
Step S402: the remote control device sends a second registration request to the P2P server, wherein the second registration request carries the identification information of the remote control device, so that the P2P server sends the identification information of the remote control device to a service server, and the service server verifies whether the remote control device is legal.
Step S403: and the P2P server receives a first registration request sent by the terminal and a second registration request sent by the remote control device.
Since the first registration request carries the identification information of the terminal and the second registration request carries the identification information of the remote controlled device, the P2P server will send the identification information of the terminal and the remote controlled device to the service server, that is, the following step S404.
Step S404: and sending the identification information of the terminal and the remotely controlled equipment to a service server.
Step S405: and the service server verifies whether the terminal and the remote control device are legal or not, and if the terminal and the remote control device are legal, the service server sends verification passing information to the P2P server.
That is, before the terminal sends the first connection request to the P2P server, both the terminal and the remotely controlled device need to register with the P2P server. Therefore, both the terminal and the remote controlled device need to send registration information to the P2P server, and the registration information carries identification information of itself, where the identification information may be an SN number for verifying whether the product of the terminal and the remote controlled device is a legal identity. After receiving the registration request sent by the terminal and the remote controlled device, the P2P server sends the corresponding device SN number carried in the registration request to the service server, and the service server verifies the SN numbers of the terminal and the remote controlled device respectively, and only if the verification is legal, the P2P server sends verification passing information to the P2P server.
Therefore, in the embodiment of the invention, the terminal accessing the P2P server and the remote-controlled device can be ensured to be legal devices by verifying the identities of the terminal and the remote-controlled device, thereby ensuring network security and communication security.
It should be noted that, in the embodiment of the present invention, in order to facilitate the registration of the terminal and the remotely controlled device in the P2P server, the P2P server preferably uses a fixed and shifted domain name or IP. And the terminal may include a mobile phone, a computer, a tablet computer, etc.
Example three:
because the router accessed by the terminal and the remote controlled device can convert the private network IP address corresponding to the terminal or the remote controlled device into the public network IP through the NAT technology, so as to enable the terminal and the remote controlled device to be capable of penetrating and accessing the public network where the P2P server is located, but because of the NAT limitation of the router, for example, the NAT of one router is an IP limitation type NAT, a port limitation type NAT or a symmetric NAT, it is possible that the access of the terminal or the remote controlled device is unsuccessful. Or due to firewall factors, for example, some firewalls analyze the application layer protocol, reject packets of some keywords, which is shown as that the firewall discards signaling packets related to P2P, or some firewalls analyze the declaration period of the link, reject the link which is not reasonable for him, which results in that the router shows as symmetric NAT, and possibly results in unsuccessful access of the terminal or the remote control device. Or the access of the terminal or the remote control equipment is not successful because the mobile gateway GPRS support node GGSN does not allow the access of the terminal to be interconnected and intercommunicated.
Therefore, on the basis of the above embodiment, in the embodiment of the present invention, as shown in fig. 5, the method further includes:
step S501: and if the terminal does not receive the IP address and the port number of the UDP channel sent by the P2P server within the first preset time length, sending a second connection request for establishing connection with the remote control equipment to the service server.
If the terminal does not receive the IP address and the port number of the UDP channel sent by the P2P server within 1min after the terminal sends the first connection request to the P2P server, it indicates that the terminal is not connected to the public network to which the P2P server is connected, at this time, the terminal sends a second connection request for establishing connection with the remote controlled device to the service server, so that the service server determines the corresponding remote controlled device, that is, the remote controlled device to which the terminal wants to connect, according to the identification information of the remote controlled device carried in the second connection request, and determines whether the remote controlled device is connected to the public network to which the P2P server is connected.
Step S502: after receiving the port number of the UDP channel sent by the P2P server, the remotely controlled device sends the IP address and the port number of the UDP channel to the traffic server.
If the service server can receive the IP address and the port number of the UDP channel sent by the remote control device, the remote control device can penetrate through the public network accessed by the P2P server, so that the service server can determine whether the terminal is the remote control device which the terminal wants to connect to according to the identification information of the remote control device.
It should be noted that step S501 and step S502 are not in strict sequence.
Step S503: and after receiving the IP address and the port number of the UDP channel sent by the remote control equipment and the second connection request sent by the terminal, the service server sends a preset random algorithm to the terminal.
That is, after determining that the remotely controlled device to which the terminal wants to connect can penetrate the public network connected to the P2P server, the traffic server sends the predetermined random algorithm to the terminal, wherein the predetermined random algorithm is the same predetermined random algorithm used by the P2P server to randomly generate the port number in the first embodiment, so that the terminal can guess the possible port number of the UDP channel by using the port guessing technique.
Step S504: and the terminal determines a first predicted port number of the UDP channel according to the preset random algorithm and sends the first predicted port number to the service server.
Step S505: and the service server checks whether the first predicted port number is correct according to the port number of the UDP channel sent by the remote control equipment, and if the first predicted port number is correct, first check passing information is sent to the terminal.
Step S506: and the terminal receives first verification passing information sent by the service server, wherein the first verification information carries the IP address of the UDP channel, and then the terminal communicates with the remote control device based on the IP address and a first predicted port number.
After the terminal obtains the preset random algorithm sent by the service server, a port guessing technology is adopted to guess a possible first predicted port number of the UDP channel, the first predicted port number is sent to the service server, and the service server checks the first predicted port number.
For example, the port number sent by the remote control device to the service server is 2020, and the possible first predicted port number of the UDP channel predicted by the terminal through the port guessing technology is also 2020, the service server determines that the check result is correct. At this time, the service server will send the first verification pass information to the terminal, and then the terminal will directly communicate with the remote controlled device based on the IP address and port number 2020 carried in the first verification pass information.
Therefore, in the embodiment of the present invention, when the terminal is not connected to the public network to which the P2P server is connected through penetration, and the remote control device is capable of being connected to the public network to which the P2P server is connected through penetration, the terminal may determine, by means of port guessing, the port number of the UDP channel received by the remote control device according to the preset random algorithm sent by the service server, so as to implement that, in a case where the terminal is not connected to the public network to which the P2P server is connected through penetration, and the remote control device is capable of being connected to the public network to which the P2P server is connected through penetration, as a better communication method, the terminal automatically establishes the UDP channel with the remote control device, and directly communicates with the remote control device based on the UDP channel, thereby overcoming the problems of tedious signal interaction and poor real-time performance in the controlled process of the electronic device in the prior art.
Example four:
on the basis of the above embodiment, in the embodiment of the present invention, as shown in fig. 6, the method further includes:
step S601: and after receiving the IP address and the port number of the UDP channel sent by the P2P server, the terminal sends the IP address and the port number of the UDP channel to the service server.
If the terminal can receive the IP address and the port number of the UDP channel sent by the P2P server, which indicates that the terminal can penetrate the public network connected to the P2P server, the terminal can send control signaling to the remote controlled device through the UDP channel, that is, the following step S602.
Step S602: and the terminal sends a control signaling to the remote control device based on the UDP channel.
Step S603: and if the terminal does not receive the response message sent by the remote control device within a second preset time length, sending a second connection request for establishing connection with the remote control device to a service server.
Assuming that the second preset time duration is 1min, if the terminal does not receive the response message sent by the remote control device within 1min after sending the control signaling to the remote control device, the terminal will determine that the remote control device is not connected to the public network accessed by the P2P server. At this time, the terminal sends a second connection request for establishing connection with the remote controlled device to the service server, where the second connection request carries identification information of the remote controlled device.
Step S604: and the service server sends a preset random algorithm to the remote control equipment.
Since the second connection request carries the identification information of the remotely controlled device, the service server determines the remotely controlled device to which the terminal wants to connect according to the identification information of the remotely controlled device carried in the second connection request, and sends a preset random algorithm to the remotely controlled device.
Step S605: and the remote control equipment receives the preset random algorithm sent by the service server.
Step S606: and determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to a service server.
Similarly, the preset random algorithm is the same preset random algorithm used when the P2P server randomly generates the port number in the first embodiment. Therefore, after the remote control device obtains the preset random algorithm sent by the service server, a port guessing technology can be adopted to guess a possible second predicted port number of the UDP channel, the second predicted port number is sent to the service server, and the service server checks the second predicted port number.
Step S607: and the service server checks whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal, and if the second predicted port number is correct, second check passing information is sent to the terminal and the remote control device.
For example, the port number sent by the terminal to the service server is 2020, and the possible first predicted port number of the UDP channel predicted by the remote control device through the port guessing technique is also 2020, the service server determines that the check result is correct.
And when the check result is correct, the service server can check the passing information to the remote controlled equipment for the second time, so that the remote controlled equipment can communicate with the terminal based on the IP address and the second predicted port number carried in the second checking passing information. Meanwhile, the service server also checks the pass information to the terminal so that the terminal knows that the remote controlled device can connect to the UDP channel, and then directly communicates with the remote controlled device according to the IP address and the port number sent by the P2P server, i.e. the subsequent steps S608 and S609.
Step S608: and the terminal receives the second check passing information sent by the service server and communicates with the remote control device based on the IP address and the port number of the UDP channel.
Step S609: and the remote control device receives second check passing information sent by the service server, wherein the second check passing information carries the IP address of the UDP channel and is communicated with the terminal based on the IP address and a second predicted port number.
Therefore, in the embodiment of the present invention, when the terminal is connected to the public network accessed by the P2P server in a penetrating manner, and the remote control device is not connected to the public network accessed by the P2P server in a penetrating manner, the remote control device may determine the port number of the UDP channel received by the terminal in a port guessing manner according to the preset random algorithm sent by the service server, so as to implement, as a better communication manner, that the remote control device automatically establishes the UDP channel with the terminal and directly communicates with the terminal based on the UDP channel in a case that the terminal is capable of being connected to the public network accessed by the P2P server in a penetrating manner, and the remote control device is not connected to the public network accessed by the P2P server in a penetrating manner.
Example five:
as can be seen from the above description, in the embodiment of the present invention, the process of the P2P server establishing the UDP channel for the terminal and the remote control device is specifically as follows:
first, as shown in fig. 7, the terminal and the remote controlled device are registered in the P2P server.
When the terminal and the remote-controlled device are successfully registered in the P2P server, that is, as shown in fig. 8, the P2P server obtains the IP addresses of the terminal and the remote-controlled device, respectively, and assigns terminal numbers to the terminal and the remote-controlled device, so that the terminal and the remote-controlled device realize point-to-point penetration, and perform information transmission.
However, when one of the terminal or the remotely controlled device fails to penetrate, the service server forwards information for the terminal or the remotely controlled device, so that when one of the terminal or the remotely controlled device fails to penetrate, a UDP channel with the other one is automatically established, and direct communication is performed based on the UDP channel.
Therefore, in the embodiment of the invention, when both the terminal and the remote-controlled device can be connected to the public network accessed by the P2P server in a penetrating way, the P2P server can directly establish a UDP channel for the terminal and the remote-controlled device, so that the terminal and the remote-controlled device can directly communicate through the UDP channel. When one of the terminal or the remote control device fails to penetrate, the terminal or the remote control device can forward information through the service server, automatically establish a UDP channel with the other party and directly communicate based on the UDP channel, so that the transmission of a control instruction by using the service server as a third party is not needed, the time of information interaction is greatly shortened, and the problem of complicated signal interaction in the prior art is solved.
Example six:
after the P2P server establishes the UDP channel for the terminal and the remote controlled device, to further ensure network security and communication security, on the basis of the foregoing embodiment, in an embodiment of the present invention, the method further includes:
monitoring heartbeat packets sent by the terminal and the remote control equipment, wherein the heartbeat packets carry verification information of corresponding equipment;
and if the heartbeat packet is not monitored or the verification information in the monitored heartbeat packet is invalid, disconnecting the DUP channel between the terminal and the remote control device.
The heartbeat packet is information sent by the terminal or the remote controlled device to the P2P server at a certain time interval, and the heartbeat packet also carries authentication information of the terminal or the remote controlled device. Therefore, the P2P server can monitor the status of the terminal or the remote control device by monitoring the heartbeat packet sent by the terminal or the remote control device.
Therefore, when the P2P server does not monitor the heartbeat packet sent by the terminal or the remote controlled device, or the verification information carried in the heartbeat packet sent by the terminal and the remote controlled device is not the preset verification information, the P2P server will automatically disconnect the DUP channel between the terminal and the remote controlled device, so as to ensure the network security and the communication security.
Example seven:
according to another aspect of the present invention, there is also provided a communication system including: P2P server, terminal and remote control device;
the terminal is used for sending a first connection request for establishing connection with a remote-controlled device to the P2P server, wherein the first connection request carries identification information of the remote-controlled device;
and the P2P server is configured to establish a UDP channel for the terminal and the remote controlled device according to the first connection request, and send an IP address and a port number of the UDP channel to the terminal and the remote controlled device, so that the terminal and the remote controlled device communicate based on the IP address and the port number.
Specifically, the system further comprises a service server;
the terminal is further configured to send a second connection request for establishing connection with the remotely controlled device to a service server if the IP address and the port number of the UDP channel sent by the P2P server are not received within a first preset time period;
the remote control device is used for sending the IP address and the port number to the service server after receiving the port number of the UDP channel sent by the P2P server;
the service server is further configured to send a preset random algorithm to the terminal after receiving the IP address and the port number of the UDP channel sent by the remotely controlled device and the second connection request sent by the terminal;
the terminal is further configured to determine a first predicted port number of the UDP channel according to the preset random algorithm, and send the first predicted port number to the service server;
the service server is further configured to check whether the first predicted port number is correct according to the port number of the UDP channel sent by the remotely controlled device, and if the first predicted port number is correct, send first check passing information to the terminal, where the first check information carries an IP address of the UDP channel;
and the terminal is also used for receiving first verification passing information sent by the service server and communicating with the remote control device based on the IP address and the first predicted port number.
Specifically, the terminal is further configured to send an IP address and a port number of the UDP channel to the service server, send a control signaling to the remote control device based on the UDP channel, and send the second connection request to the service server if a response message sent by the remote control device is not received within a second preset time period;
the service server is further configured to send a preset random algorithm to the remotely controlled device after receiving the second connection request;
the remote control equipment is also used for receiving a preset random algorithm sent by the service server; determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to the service server;
the service server is further configured to check whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal, and if so, send second check passing information to the terminal and the remote controlled device, where the second check passing information carries an IP address of the UDP channel;
the remote control device is also used for receiving second check-up passing information sent by the service server and communicating with the terminal based on the IP address and a second predicted port number;
and the terminal is also used for receiving second check-up passing information sent by the service server and communicating with the remote control device based on the IP address and the port number of the UDP channel.
Example eight:
according to another aspect of the present invention, there is also provided an electronic device, and fig. 9 is an electronic device provided in an embodiment of the present invention, the electronic device including: a processor 901, a memory 902, and a transceiver 903;
in fig. 9, the bus architecture may include any number of interconnected buses and bridges, with one or more processors, represented by processor 901, and various circuits, represented by memory 902, linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The transceiver 903 may be a number of elements including a transmitter and a receiver that provide a means for communicating with various other apparatus over a transmission medium. The processor 901 is responsible for managing a bus architecture and general processing, and the memory 902 may store data used by the processor 901 in performing operations.
Alternatively, the processor 901 may be a CPU (central processing unit), an ASIC (Application specific integrated Circuit), an FPGA (Field Programmable Gate Array), or a CPLD (Complex Programmable Logic Device).
The processor 901 is configured to read the program in the memory 902, and execute the following processes: receiving a first connection request which is sent by a terminal and establishes connection with a remote-controlled device through the transceiver 903, wherein the first connection request carries identification information of the remote-controlled device; according to the first connection request, establishing a UDP channel for the terminal and the remote control device, and sending an IP address and a port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number;
the transceiver 903 is used for receiving and transmitting data under the control of the processor 901.
Specifically, the processor 901 is further configured to receive, through the transceiver 903, a first registration request sent by a terminal and a second registration request sent by a remote controlled device before receiving the first connection request sent by the terminal to establish a connection with the remote controlled device, where the first registration request carries identification information of the terminal, and the second registration request carries identification information of the remote controlled device; sending the identification information of the terminal and the remotely controlled equipment to a service server, so that the service server verifies whether the terminal and the remotely controlled equipment are legal or not; and if the verification passing information sent by the service server is received, executing the subsequent steps.
Specifically, the processor 901 is further configured to monitor a heartbeat packet sent by the terminal and the remotely controlled device after establishing a UDP channel for the terminal and the remotely controlled device according to the first connection request, where the heartbeat packet carries verification information of a corresponding device; and if the heartbeat packet is not monitored or the verification information in the monitored heartbeat packet is invalid, disconnecting the DUP channel between the terminal and the remote control device.
Example nine:
according to another aspect of the present invention, there is also provided a terminal, and fig. 10 is a terminal according to an embodiment of the present invention, where the terminal includes: a processor 1001, a memory 1002, and a transceiver 1003;
in fig. 10, the bus architecture may include any number of interconnected buses and bridges, with one or more processors, represented by the processor 1001, and various circuits, represented by the memory 1002, being linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The transceiver 1003 may be a number of elements including a transmitter and a receiver, providing a means for communicating with various other apparatus over a transmission medium. The processor 1001 is responsible for managing the bus architecture and general processing, and the memory 1002 may store data used by the processor 1001 in performing operations.
Alternatively, the processor 1001 may be a CPU (central processing unit), an ASIC (Application specific integrated Circuit), an FPGA (Field Programmable Gate Array), or a CPLD (Complex Programmable Logic Device).
The processor 1001 is configured to read the program in the memory 1002, and execute the following processes: sending a first connection request for establishing connection with a remote controlled device to a P2P server through the transceiver 1003, so that the P2P server establishes a UDP channel for the terminal and the remote controlled device, wherein the first connection request carries identification information of the remote controlled device; receiving an IP address and a port number of a UDP channel sent by the P2P server, and communicating with the remote control device based on the IP address and the port number;
the transceiver is used for receiving and transmitting data under the control of the processor.
Specifically, the processor 1001 is further configured to send a first registration request to the P2P server through the transceiver 1003 before sending a first connection request for establishing a connection with a remote controlled device to the P2P server, where the first registration request carries identification information of the terminal, so that the P2P server sends the identification information of the terminal to a service server, and the service server verifies whether the terminal is legal.
Specifically, the processor 1001 is further configured to send, through the transceiver 1003, the IP address and the port number of the UDP channel to a service server after receiving the IP address and the port number of the UDP channel sent by the P2P server.
Specifically, the processor 1001 is further configured to send, through the transceiver 1003, a second connection request for establishing a connection with the remote control device to a service server if the IP address and the port number of the UDP channel sent by the P2P server are not received within a first preset time period; receiving a preset random algorithm sent by the service server, wherein the preset random algorithm is sent by the service server after the IP address and the port number sent by the remotely controlled equipment are received; determining a first predicted port number of the UDP channel according to the preset random algorithm, and sending the first predicted port number to the service server, so that the service server checks whether the first predicted port number is correct according to the port number of the UDP channel sent by the remote control device; and if first verification passing information sent by the service server is received, wherein the first verification information carries the IP address of the UDP channel, communicating with the remote control device based on the IP address and a first predicted port number.
Specifically, the processor 1001 is further configured to send, through the transceiver 1003, a control signaling to the remote controlled device based on the UDP channel; if the response message sent by the remote control device is not received within a second preset time span, sending the second connection request to a service server, so that the service server sends a preset random algorithm to the remote control device; and if second check-up passing information sent by the service server is received, communicating with the remote-controlled equipment based on the IP address and the port number of the UDP channel, wherein the second check-up passing information is sent when the service server checks up the second predicted port number of the UDP channel established by the P2P server according to the preset random algorithm to the remote-controlled equipment according to the port number of the UDP channel sent by the terminal.
Example ten:
according to another aspect of the present invention, there is also provided an electronic device, and fig. 11 is an electronic device provided in an embodiment of the present invention, the electronic device including: a processor 1101, a memory 1102, and a transceiver 1103;
in FIG. 11, the bus architecture may include any number of interconnected buses and bridges, with one or more processors, represented by processor 1101, and various circuits of memory, represented by memory 1102, being linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The transceiver 1103 can be a plurality of elements including a transmitter and a receiver that provide a means for communicating with various other apparatus over a transmission medium. The processor 1101 is responsible for managing the bus architecture and general processing, and the memory 1102 may store data used by the processor 1101 in performing operations.
Alternatively, the processor 1101 may be a CPU (central processing unit), an ASIC (Application specific integrated Circuit), an FPGA (Field Programmable Gate Array), or a CPLD (Complex Programmable Logic Device).
The processor 1101 is configured to read the program in the memory, and execute the following processes: receiving, by the transceiver 1103, an IP address and a port number of a UDP channel sent by the P2P server, and communicating with the terminal based on the IP address and the port number;
the transceiver 1103 is used for receiving and transmitting data under the control of the processor 1101.
Specifically, the processor 1101 is further configured to send a second registration request to the P2P server through the transceiver 1103 before receiving the IP address and the port number of the UDP channel sent by the P2P server, where the second registration request carries identification information of the remote controlled device, so that the P2P server sends the identification information of the remote controlled device to a service server, and the service server verifies whether the remote controlled device is legal.
Specifically, the processor 1101 is further configured to send, through the transceiver 1103, the IP address and the port number of the UDP channel to a traffic server after receiving the IP address and the port number of the UDP channel sent by the P2P server.
Specifically, the processor 1101 is further configured to receive, through the transceiver 1103, a preset random algorithm sent by a service server; determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to the service server, so that the service server checks whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal; and if second check-up passing information sent by the service server is received, wherein the second check-up information carries the IP address of the UDP channel, communicating with the terminal based on the IP address and a second predicted port number.
Example eleven:
according to another aspect of the present invention, there is also provided a communication apparatus, and fig. 12 is a communication apparatus according to an embodiment of the present invention, the apparatus including:
a first receiving module 1201, configured to receive a first connection request sent by a terminal to establish a connection with a remote controlled device, where the first connection request carries identification information of the remote controlled device;
an establishing module 1202, configured to establish a UDP channel for the terminal and the remote controlled device according to the first connection request, and send an IP address and a port number of the UDP channel to the terminal and the remote controlled device, so that the terminal and the remote controlled device perform communication based on the IP address and the port number.
Specifically, the apparatus further comprises:
a second receiving module 1203, configured to receive a first registration request sent by a terminal and a second registration request sent by a remote controlled device before a P2P server receives the first connection request sent by the terminal and used for establishing a connection with the remote controlled device, where the first registration request carries identification information of the terminal, and the second registration request carries identification information of the remote controlled device;
a sending module 1204, configured to send the identification information of the terminal and the remotely controlled device to a service server, so that the service server verifies whether the terminal and the remotely controlled device are legal; and if the verification passing information sent by the service server is received, executing the subsequent steps.
Specifically, the apparatus further comprises:
a monitoring module 1205, configured to monitor a heartbeat packet sent by the terminal and the remote controlled device after UDP channels are established for the terminal and the remote controlled device according to the first connection request, where the heartbeat packet carries verification information of a corresponding device;
a disconnecting module 1206, configured to disconnect the DUP channel between the terminal and the remotely controlled device if no heartbeat packet is monitored, or the verification information in the monitored heartbeat packet is invalid.
Example twelve:
according to another aspect of the present invention, there is also provided a communication apparatus, and fig. 13 is a communication apparatus according to an embodiment of the present invention, the apparatus including:
a first sending module 1301, configured to send a first connection request for establishing a connection with a remote controlled device to a P2P server, so that the P2P server establishes a UDP channel for the terminal and the remote controlled device, where the first connection request carries identification information of the remote controlled device;
a communication module 1302, configured to receive an IP address and a port number of a UDP channel sent by the P2P server, and communicate with the remote control device based on the IP address and the port number.
Specifically, the apparatus further comprises:
a second sending module 1303, configured to send a first registration request to the P2P server before sending a first connection request for establishing a connection with a remote controlled device to the P2P server, where the first registration request carries identification information of the terminal, so that the P2P server sends the identification information of the terminal to a service server, and the service server verifies whether the terminal is legal.
Specifically, the apparatus further comprises:
a third sending module 1304, configured to send the IP address and the port number of the UDP channel to the service server after receiving the IP address and the port number of the UDP channel sent by the P2P server.
Specifically, the apparatus further comprises:
a fourth sending module 1305, configured to send, to the service server, a second connection request for establishing a connection with the remotely controlled device if the IP address and the port number of the UDP channel sent by the P2P are not received within a first preset time period;
a receiving module 1306, configured to receive a preset random algorithm sent by the service server, where the preset random algorithm is sent by the service server after receiving the IP address and the port number sent by the remotely controlled device;
a guessing module 1307, configured to determine, according to the preset random algorithm, a first predicted port number of the UDP channel, and send the first predicted port number to the service server, so that the service server checks, according to the port number of the UDP channel sent by the remotely controlled device, whether the first predicted port number is correct;
the communication module 1302 is further configured to, if first verification passing information sent by the service server is received, where the first verification information carries an IP address of the UDP channel, communicate with the remote controlled device based on the IP address and a first predicted port number.
Specifically, the communication module 1302 is specifically configured to send a control signaling to the remote controlled device based on the UDP channel; if the response message sent by the remote control device is not received within a second preset time span, sending the second connection request to a service server, so that the service server sends a preset random algorithm to the remote control device; and if second check-up passing information sent by the service server is received, communicating with the remote-controlled equipment based on the IP address and the port number of the UDP channel, wherein the second check-up passing information is sent when the service server checks up the second predicted port number of the UDP channel established by the P2P server according to the preset random algorithm to the remote-controlled equipment according to the port number of the UDP channel sent by the terminal.
Example thirteen:
according to another aspect of the present invention, there is also provided a communication apparatus, and fig. 14 is a communication apparatus according to an embodiment of the present invention, the apparatus including:
a first receiving module 1401, configured to receive an IP address and a port number of a UDP channel sent by a P2P server;
a communication module 1402, configured to communicate with the terminal based on the IP address and the port number.
Specifically, the apparatus further comprises:
a first sending module 1403, configured to send a second registration request to the P2P server before receiving the IP address and the port number of the UDP channel sent by the P2P server, where the second registration request carries the identification information of the remotely controlled device, so that the P2P server sends the identification information of the remotely controlled device to a service server, and the service server verifies whether the remotely controlled device is legal.
Specifically, the apparatus further comprises:
a second sending module 1404, configured to send the IP address and the port number of the UDP channel to a service server after receiving the IP address and the port number of the UDP channel sent by the P2P server.
Specifically, the apparatus further comprises:
a second receiving module 1405, configured to receive a preset random algorithm sent by the service server;
a guessing module 1406, configured to determine, according to the preset random algorithm, a second predicted port number of the UDP channel, and send the second predicted port number to the service server, so that the service server checks, according to the port number of the UDP channel sent by the terminal, whether the second predicted port number is correct;
the communication module 1402 is further configured to communicate with the terminal based on the IP address and a second predicted port number if second check-passing information sent by the service server is received, where the second check-passing information carries the IP address of the UDP channel.
Example fourteen:
according to another aspect of the present invention, there is also provided an electronic device, and fig. 15 is an electronic device provided in an embodiment of the present invention, the electronic device including: the system comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 complete communication with each other through the communication bus 1504;
the memory 1503 stores therein a computer program that, when executed by the processor 1501, causes the processor 1501 to execute the steps of the above-described communication method:
receiving a first connection request which is sent by a terminal and establishes connection with a remote controlled device, wherein the first connection request carries identification information of the remote controlled device;
and establishing a UDP (user Datagram protocol) channel for the terminal and the remote control device according to the first connection request, and sending the IP address and the port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number.
Specifically, before the receiving terminal sends a first connection request for establishing a connection with a remote controlled device, the method further includes:
receiving a first registration request sent by the terminal and a second registration request sent by the remote control device, wherein the first registration request carries identification information of the terminal, and the second registration request carries identification information of the remote control device;
sending the identification information of the terminal and the remotely controlled equipment to a service server, so that the service server verifies whether the terminal and the remotely controlled equipment are legal or not; and if the verification passing information sent by the service server is received, executing the subsequent steps.
Specifically, after establishing a UDP channel for the terminal and the remote controlled device according to the first connection request, the method further includes:
monitoring heartbeat packets sent by the terminal and the remote control equipment, wherein the heartbeat packets carry verification information of corresponding equipment;
and if the heartbeat packet is not monitored or the verification information in the monitored heartbeat packet is invalid, disconnecting the DUP channel between the terminal and the remote control device.
The communication bus 1502 mentioned in the electronic devices in the above embodiments may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
A communication interface 1504 for communication between the above-mentioned electronic device and other devices.
The Memory 1503 may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The processor 1501 may be a general-purpose processor, including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
Example fifteen:
according to another aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program executable by an electronic device, the program, when run on the electronic device, causing the electronic device to perform the steps of the above-mentioned communication method:
receiving a first connection request which is sent by a terminal and establishes connection with a remote controlled device, wherein the first connection request carries identification information of the remote controlled device;
and establishing a UDP (user Datagram protocol) channel for the terminal and the remote control device according to the first connection request, and sending the IP address and the port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number.
Specifically, before the receiving terminal sends a first connection request for establishing a connection with a remote controlled device, the method further includes:
receiving a first registration request sent by the terminal and a second registration request sent by the remote control device, wherein the first registration request carries identification information of the terminal, and the second registration request carries identification information of the remote control device;
sending the identification information of the terminal and the remotely controlled equipment to a service server, so that the service server verifies whether the terminal and the remotely controlled equipment are legal or not; and if the verification passing information sent by the service server is received, executing the subsequent steps.
Specifically, after establishing a UDP channel for the terminal and the remote controlled device according to the first connection request, the method further includes:
monitoring heartbeat packets sent by the terminal and the remote control equipment, wherein the heartbeat packets carry verification information of corresponding equipment;
and if the heartbeat packet is not monitored or the verification information in the monitored heartbeat packet is invalid, disconnecting the DUP channel between the terminal and the remote control device.
The computer readable storage medium in the above embodiments may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs), etc.
Example sixteen:
according to another aspect of the present invention, there is also provided an electronic device, and fig. 16 is an electronic device provided in an embodiment of the present invention, the electronic device including: the system comprises a processor 1601, a communication interface 1602, a memory 1603 and a communication bus 1604, wherein the processor 1601, the communication interface 1602 and the memory 1603 are communicated with each other through the communication bus 1604;
the memory 1603 stores therein a computer program that, when executed by the processor 1601, causes the processor 1601 to perform the steps of the communication method described above:
sending a first connection request for establishing connection with a remote-controlled device to a P2P server, so that the P2P server establishes a UDP channel for the terminal and the remote-controlled device, wherein the first connection request carries identification information of the remote-controlled device;
and receiving the IP address and the port number of the UDP channel sent by the P2P server, and communicating with the remote control device based on the IP address and the port number.
Specifically, before the sending of the first connection request for establishing connection with the remote controlled device to the P2P server, the method further includes:
and sending a first registration request to the P2P server, wherein the first registration request carries the identification information of the terminal, so that the P2P server sends the identification information of the terminal to a service server, and the service server verifies whether the terminal is legal or not.
Specifically, after receiving the IP address and the port number of the UDP channel sent by the P2P server, the method further includes:
and sending the IP address and the port number of the UDP channel to a service server.
Specifically, if the IP address and the port number of the UDP channel sent by the P2P server are not received within a first preset time period, the method further includes:
sending a second connection request for establishing connection with the remote control device to a service server;
receiving a preset random algorithm sent by the service server, wherein the preset random algorithm is sent by the service server after the IP address and the port number sent by the remotely controlled equipment are received;
determining a first predicted port number of the UDP channel according to the preset random algorithm, and sending the first predicted port number to the service server, so that the service server checks whether the first predicted port number is correct according to the port number of the UDP channel sent by the remote control device;
and if first verification passing information sent by the service server is received, wherein the first verification information carries the IP address of the UDP channel, communicating with the remote control device based on the IP address and a first predicted port number.
Specifically, the method further comprises:
sending control signaling to the remote controlled device based on the UDP channel;
if the response message sent by the remote control device is not received within a second preset time span, sending the second connection request to a service server, so that the service server sends a preset random algorithm to the remote control device;
and if second check-up passing information sent by the service server is received, communicating with the remote-controlled equipment based on the IP address and the port number of the UDP channel, wherein the second check-up passing information is sent when the service server checks up the second predicted port number of the UDP channel established by the P2P server according to the preset random algorithm to the remote-controlled equipment according to the port number of the UDP channel sent by the terminal.
The communication bus 1602 mentioned in the electronic devices in the above embodiments may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
A communication interface 1604 for communication between the electronic device and other devices.
The processor 1601 may be a general-purpose processor, and includes a central processing unit (cpu), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
Example seventeen:
according to another aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program executable by an electronic device, the program, when run on the electronic device, causing the processor to perform the steps of the above-mentioned communication method:
sending a first connection request for establishing connection with a remote-controlled device to a P2P server, so that the P2P server establishes a UDP channel for the terminal and the remote-controlled device, wherein the first connection request carries identification information of the remote-controlled device;
and receiving the IP address and the port number of the UDP channel sent by the P2P server, and communicating with the remote control device based on the IP address and the port number.
Specifically, before the sending of the first connection request for establishing connection with the remote controlled device to the P2P server, the method further includes:
and sending a first registration request to the P2P server, wherein the first registration request carries the identification information of the terminal, so that the P2P server sends the identification information of the terminal to a service server, and the service server verifies whether the terminal is legal or not.
Specifically, after receiving the IP address and the port number of the UDP channel sent by the P2P server, the method further includes:
and sending the IP address and the port number of the UDP channel to a service server.
Specifically, if the IP address and the port number of the UDP channel sent by the P2P server are not received within a first preset time period, the method further includes:
sending a second connection request for establishing connection with the remote control device to a service server;
receiving a preset random algorithm sent by the service server, wherein the preset random algorithm is sent by the service server after the IP address and the port number sent by the remotely controlled equipment are received;
determining a first predicted port number of the UDP channel according to the preset random algorithm, and sending the first predicted port number to the service server, so that the service server checks whether the first predicted port number is correct according to the port number of the UDP channel sent by the remote control device;
and if first verification passing information sent by the service server is received, wherein the first verification information carries the IP address of the UDP channel, communicating with the remote control device based on the IP address and a first predicted port number.
Specifically, the method further comprises:
sending control signaling to the remote controlled device based on the UDP channel;
if the response message sent by the remote control device is not received within a second preset time span, sending the second connection request to a service server, so that the service server sends a preset random algorithm to the remote control device;
and if second check-up passing information sent by the service server is received, communicating with the remote-controlled equipment based on the IP address and the port number of the UDP channel, wherein the second check-up passing information is sent when the service server checks up the second predicted port number of the UDP channel established by the P2P server according to the preset random algorithm to the remote-controlled equipment according to the port number of the UDP channel sent by the terminal.
The computer readable storage medium in the above embodiments may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs), etc.
Example eighteen:
according to another aspect of the present invention, there is also provided an electronic device, and fig. 17 is an electronic device provided in an embodiment of the present invention, the electronic device including: the system comprises a processor 1701, a communication interface 1702, a memory 1703 and a communication bus 1704, wherein the processor 1701, the communication interface 1702 and the memory 1703 are communicated with each other through the communication bus 1704;
the memory 1703 stores therein a computer program that, when executed by the processor 1701, causes the processor 1701 to perform the steps of the above-described communication method:
and receiving the IP address and the port number of the UDP channel sent by the P2P server, and communicating with the terminal based on the IP address and the port number.
Specifically, before receiving the IP address and the port number of the UDP channel sent by the P2P server, the method further includes:
and sending a second registration request to the P2P server, wherein the second registration request carries the identification information of the remote controlled device, so that the P2P server sends the identification information of the remote controlled device to a service server, and the service server verifies whether the remote controlled device is legal or not.
Specifically, after receiving the IP address and the port number of the UDP channel sent by the P2P server, the method further includes:
and sending the IP address and the port number of the UDP channel to a service server.
Specifically, the method further comprises:
receiving a preset random algorithm sent by a service server;
determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to the service server, so that the service server checks whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal;
and if second check-up passing information sent by the service server is received, wherein the second check-up information carries the IP address of the UDP channel, communicating with the terminal based on the IP address and a second predicted port number.
The communication bus 1702 mentioned in the electronic devices in the above embodiments may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
A communication interface 1704 for communication between the electronic device and other devices.
The Memory 1703 may include a Random Access Memory (RAM) and a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The processor 1701 may be a general-purpose processor including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
Example nineteenth:
according to another aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program executable by an electronic device, the program, when run on the electronic device, causing the processor to perform the steps of the above-mentioned communication method:
and receiving the IP address and the port number of the UDP channel sent by the P2P server, and communicating with the terminal based on the IP address and the port number.
Specifically, before receiving the IP address and the port number of the UDP channel sent by the P2P server, the method further includes:
and sending a second registration request to the P2P server, wherein the second registration request carries the identification information of the remote controlled device, so that the P2P server sends the identification information of the remote controlled device to a service server, and the service server verifies whether the remote controlled device is legal or not.
Specifically, after receiving the IP address and the port number of the UDP channel sent by the P2P server, the method further includes:
and sending the IP address and the port number of the UDP channel to a service server.
Specifically, the method further comprises:
receiving a preset random algorithm sent by a service server;
determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to the service server, so that the service server checks whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal;
and if second check-up passing information sent by the service server is received, wherein the second check-up information carries the IP address of the UDP channel, communicating with the terminal based on the IP address and a second predicted port number.
The computer readable storage medium in the above embodiments may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs), etc.
For the system/apparatus embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
It is to be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or operation from another entity or operation without necessarily requiring or implying any actual such relationship or order between such entities or operations.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely application embodiment, or an embodiment combining application and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
Claims (22)
1. A method of communication, the method comprising:
receiving a first connection request which is sent by a terminal and establishes connection with a remote controlled device, wherein the first connection request carries identification information of the remote controlled device;
and establishing a User Data Protocol (UDP) channel for the terminal and the remote control device according to the first connection request, and sending an IP address and a port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number.
2. The method of claim 1, wherein prior to receiving the first connection request sent by the terminal to establish a connection with the remotely controlled device, the method further comprises:
receiving a first registration request sent by the terminal and a second registration request sent by the remote control device, wherein the first registration request carries identification information of the terminal, and the second registration request carries identification information of the remote control device;
sending the identification information of the terminal and the remotely controlled equipment to a service server, so that the service server verifies whether the terminal and the remotely controlled equipment are legal or not; and if the verification passing information sent by the service server is received, executing the subsequent steps.
3. The method of claim 1, wherein after establishing a UDP channel for the terminal and the remotely controlled device in accordance with the first connection request, the method further comprises:
monitoring heartbeat packets sent by the terminal and the remotely controlled equipment, wherein the heartbeat packets carry verification information of corresponding equipment;
and if the heartbeat packet is not monitored or the verification information in the monitored heartbeat packet is invalid, disconnecting the DUP channel between the terminal and the remote control device.
4. A method of communication, the method comprising:
sending a first connection request for establishing connection with a remote control device to a P2P server, so that the P2P server establishes a User Data Protocol (UDP) channel for the terminal and the remote control device, wherein the first connection request carries identification information of the remote control device;
and receiving the IP address and the port number of the UDP channel sent by the P2P server, and communicating with the remote control device based on the IP address and the port number.
5. The method of claim 4, wherein if the IP address and the port number of the UDP tunnel sent by the P2P server are not received within a first preset time period, the method further comprises:
sending a second connection request for establishing connection with the remote control device to a service server;
receiving a preset random algorithm sent by the service server, wherein the preset random algorithm is sent by the service server after the IP address and the port number sent by the remotely controlled equipment are received;
determining a first predicted port number of the UDP channel according to the preset random algorithm, and sending the first predicted port number to the service server, so that the service server checks whether the first predicted port number is correct according to the port number of the UDP channel sent by the remote control device;
and if first verification passing information sent by the service server is received, wherein the first verification information carries the IP address of the UDP channel, communicating with the remote control device based on the IP address and a first predicted port number.
6. The method of claim 4 or 5, wherein the method further comprises:
sending control signaling to the remote controlled device based on the UDP channel;
if the response message sent by the remote control device is not received within a second preset time span, sending the second connection request to a service server, so that the service server sends a preset random algorithm to the remote control device;
and if second check-up passing information sent by the service server is received, communicating with the remote-controlled equipment based on the IP address and the port number of the UDP channel, wherein the second check-up passing information is sent when the service server checks up the second predicted port number of the UDP channel established by the P2P server according to the preset random algorithm to the remote-controlled equipment according to the port number of the UDP channel sent by the terminal.
7. A method of communication, the method comprising:
and receiving the IP address and the port number of the UDP channel sent by the P2P server, and communicating with the terminal based on the IP address and the port number.
8. The method of claim 7, wherein the method further comprises:
receiving a preset random algorithm sent by a service server;
determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to the service server, so that the service server checks whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal;
and if second check-up passing information sent by the service server is received, wherein the second check-up information carries the IP address of the UDP channel, communicating with the terminal based on the IP address and a second predicted port number.
9. An electronic device, characterized in that the electronic device comprises: a processor, a memory, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: receiving a first connection request which is sent by a terminal and is used for establishing connection with a remote-controlled device through the transceiver, wherein the first connection request carries identification information of the remote-controlled device; according to the first connection request, establishing a User Data Protocol (UDP) channel for the terminal and the remote control device, and sending an IP address and a port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number;
the transceiver is used for receiving and transmitting data under the control of the processor.
10. The electronic device according to claim 9, wherein the processor is further configured to, after establishing a UDP channel for the terminal and the remote controlled device according to the first connection request, monitor a heartbeat packet sent by the terminal and the remote controlled device, where the heartbeat packet carries authentication information of a corresponding device; and if the heartbeat packet is not monitored or the verification information in the monitored heartbeat packet is invalid, disconnecting the DUP channel between the terminal and the remote control device.
11. A terminal, characterized in that the terminal comprises: a processor, a memory, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: sending a first connection request for establishing connection with a remote control device to a P2P server through the transceiver, so that the P2P server establishes a User Data Protocol (UDP) channel for the terminal and the remote control device, wherein the first connection request carries identification information of the remote control device; receiving an IP address and a port number of a UDP channel sent by the P2P server, and communicating with the remote control device based on the IP address and the port number;
the transceiver is used for receiving and transmitting data under the control of the processor.
12. The terminal of claim 11, wherein the processor is further configured to send a second connection request for establishing a connection with the remotely controlled device to a traffic server through the transceiver if the IP address and the port number of the UDP channel sent by the P2P server are not received within a first preset time period; receiving a preset random algorithm sent by the service server, wherein the preset random algorithm is sent by the service server after the IP address and the port number sent by the remotely controlled equipment are received; determining a first predicted port number of the UDP channel according to the preset random algorithm, and sending the first predicted port number to the service server, so that the service server checks whether the first predicted port number is correct according to the port number of the UDP channel sent by the remote control device; and if first verification passing information sent by the service server is received, wherein the first verification information carries the IP address of the UDP channel, communicating with the remote control device based on the IP address and a first predicted port number.
13. The terminal of claim 11 or 12, wherein the processor is further configured to send control signaling to the remotely controlled device via the transceiver based on the UDP channel; if the response message sent by the remote control device is not received within a second preset time span, sending the second connection request to a service server, so that the service server sends a preset random algorithm to the remote control device; and if second check-up passing information sent by the service server is received, communicating with the remote-controlled equipment based on the IP address and the port number of the UDP channel, wherein the second check-up passing information is sent when the service server checks up the second predicted port number of the UDP channel established by the P2P server according to the preset random algorithm to the remote-controlled equipment according to the port number of the UDP channel sent by the terminal.
14. An electronic device, characterized in that the electronic device comprises: a processor, a memory, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: receiving an IP address and a port number of a User Data Protocol (UDP) channel sent by a P2P server through the transceiver, and communicating with a terminal based on the IP address and the port number;
the transceiver is used for receiving and transmitting data under the control of the processor.
15. The electronic device of claim 14, wherein the processor is further configured to receive, via the transceiver, a predetermined random algorithm sent by a traffic server; determining a second predicted port number of the UDP channel according to the preset random algorithm, and sending the second predicted port number to the service server, so that the service server checks whether the second predicted port number is correct according to the port number of the UDP channel sent by the terminal; and if second check-up passing information sent by the service server is received, wherein the second check-up information carries the IP address of the UDP channel, communicating with the terminal based on the IP address and a second predicted port number.
16. A communication system, the system comprising: electronic device as claimed in any of claims 9-10 applied to a P2P server, a terminal as claimed in any of claims 11-13, and an electronic device as claimed in any of claims 14-15 applied to a remotely controlled device.
17. A communications apparatus, the apparatus comprising:
a first receiving module, configured to receive a first connection request sent by a terminal to establish a connection with a remote-controlled device, where the first connection request carries identification information of the remote-controlled device,
and the establishing module is used for establishing a User Data Protocol (UDP) channel for the terminal and the remote control device according to the first connection request, and sending an IP address and a port number of the UDP channel to the terminal and the remote control device, so that the terminal and the remote control device communicate based on the IP address and the port number.
18. A communications apparatus, the apparatus comprising:
a first sending module, configured to send a first connection request for establishing a connection with a remote controlled device to a P2P server, so that the P2P server establishes a user data protocol UDP channel for the terminal and the remote controlled device, where the first connection request carries identification information of the remote controlled device;
and the communication module is used for receiving the IP address and the port number of the UDP channel sent by the P2P server and communicating with the remote control device based on the IP address and the port number.
19. A communications apparatus, the apparatus comprising:
the first receiving module is used for receiving the IP address and the port number of a User Data Protocol (UDP) channel sent by the P2P server;
and the communication module is used for communicating with the terminal based on the IP address and the port number.
20. A computer-readable storage medium, characterized in that it stores a computer program executable by an electronic device, which program, when run on the electronic device, causes the electronic device to carry out the steps of the method according to any one of claims 1-3.
21. A computer-readable storage medium, characterized in that it stores a computer program executable by an electronic device, which program, when run on the electronic device, causes the electronic device to carry out the steps of the method of any of claims 4-6.
22. A computer-readable storage medium, having stored thereon a computer program executable by an electronic device, for causing the electronic device to perform the steps of the method of any one of claims 7-8, when the program is run on the electronic device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810736581.3A CN110691110B (en) | 2018-07-06 | 2018-07-06 | Communication method, device, system, terminal, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810736581.3A CN110691110B (en) | 2018-07-06 | 2018-07-06 | Communication method, device, system, terminal, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110691110A true CN110691110A (en) | 2020-01-14 |
CN110691110B CN110691110B (en) | 2022-01-25 |
Family
ID=69107195
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810736581.3A Active CN110691110B (en) | 2018-07-06 | 2018-07-06 | Communication method, device, system, terminal, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110691110B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111787261A (en) * | 2020-06-04 | 2020-10-16 | 视联动力信息技术股份有限公司 | Audio and video data sending method and device, electronic equipment and storage medium |
CN111953798A (en) * | 2020-08-25 | 2020-11-17 | 杭州安恒信息技术股份有限公司 | Cross-network communication method, device and system and proxy server |
CN112751929A (en) * | 2020-12-28 | 2021-05-04 | 深圳市科创思科技有限公司 | Method and system for communicating with remote PLC (programmable logic controller) equipment |
CN113517901A (en) * | 2021-04-13 | 2021-10-19 | 深圳市太美亚电子科技有限公司 | Intelligent bracelet of solar intelligent household system and control method thereof |
CN118399608A (en) * | 2024-06-21 | 2024-07-26 | 国网山东省电力公司泰安供电公司 | Combined remote control method, system, device and medium for multiple power monitoring systems |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102385514A (en) * | 2011-10-20 | 2012-03-21 | 百度在线网络技术(北京)有限公司 | Method, equipment and system for conducting management operation on software in centralized way |
CN102413182A (en) * | 2011-11-17 | 2012-04-11 | 南京天溯自动化控制系统有限公司 | Intelligent household equipment remote monitoring device and method |
CN104202398A (en) * | 2014-09-04 | 2014-12-10 | 北京星网锐捷网络技术有限公司 | Remote control method, device and system |
CN104566783A (en) * | 2014-12-05 | 2015-04-29 | 广东志高空调有限公司 | Air conditioner control method and air conditioner control system |
CN105072179A (en) * | 2015-08-05 | 2015-11-18 | 哈尔滨朋来科技开发有限公司 | Intelligent security guard host control system and communication method thereof |
CN106572149A (en) * | 2016-10-13 | 2017-04-19 | 芯海科技(深圳)股份有限公司 | Writer remote control device and method based on P2P network technology |
-
2018
- 2018-07-06 CN CN201810736581.3A patent/CN110691110B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102385514A (en) * | 2011-10-20 | 2012-03-21 | 百度在线网络技术(北京)有限公司 | Method, equipment and system for conducting management operation on software in centralized way |
CN102413182A (en) * | 2011-11-17 | 2012-04-11 | 南京天溯自动化控制系统有限公司 | Intelligent household equipment remote monitoring device and method |
CN104202398A (en) * | 2014-09-04 | 2014-12-10 | 北京星网锐捷网络技术有限公司 | Remote control method, device and system |
CN104566783A (en) * | 2014-12-05 | 2015-04-29 | 广东志高空调有限公司 | Air conditioner control method and air conditioner control system |
CN105072179A (en) * | 2015-08-05 | 2015-11-18 | 哈尔滨朋来科技开发有限公司 | Intelligent security guard host control system and communication method thereof |
CN106572149A (en) * | 2016-10-13 | 2017-04-19 | 芯海科技(深圳)股份有限公司 | Writer remote control device and method based on P2P network technology |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111787261A (en) * | 2020-06-04 | 2020-10-16 | 视联动力信息技术股份有限公司 | Audio and video data sending method and device, electronic equipment and storage medium |
CN111953798A (en) * | 2020-08-25 | 2020-11-17 | 杭州安恒信息技术股份有限公司 | Cross-network communication method, device and system and proxy server |
CN112751929A (en) * | 2020-12-28 | 2021-05-04 | 深圳市科创思科技有限公司 | Method and system for communicating with remote PLC (programmable logic controller) equipment |
CN112751929B (en) * | 2020-12-28 | 2023-03-14 | 深圳市科创思科技有限公司 | Method and system for communicating with remote PLC (programmable logic controller) equipment |
CN113517901A (en) * | 2021-04-13 | 2021-10-19 | 深圳市太美亚电子科技有限公司 | Intelligent bracelet of solar intelligent household system and control method thereof |
CN118399608A (en) * | 2024-06-21 | 2024-07-26 | 国网山东省电力公司泰安供电公司 | Combined remote control method, system, device and medium for multiple power monitoring systems |
Also Published As
Publication number | Publication date |
---|---|
CN110691110B (en) | 2022-01-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110691110B (en) | Communication method, device, system, terminal, equipment and medium | |
US10630551B2 (en) | Method and apparatus for automatic networking of gateway device | |
CN114025021B (en) | Communication method, system, medium and electronic equipment crossing Kubernetes cluster | |
CN109450905B (en) | Method, device and system for transmitting data | |
CN111083102A (en) | Internet of things data processing method, device and equipment | |
US11411957B2 (en) | Broker-coordinated selective sharing of data | |
CN104243210A (en) | Method and system for remotely having access to administrative web pages of routers | |
US8611358B2 (en) | Mobile network traffic management | |
CN110177010B (en) | Link switching method and device | |
CN114513829A (en) | Network access method, device, core network, server and terminal | |
CN108024306B (en) | TCP connection management method and gateway equipment | |
CN110535746B (en) | Virtual private network VPN sharing method and device, electronic equipment and storage medium | |
CN116032691B (en) | Shooting range interconnection method, electronic equipment and readable storage medium | |
CN110430478B (en) | Networking communication method, device, terminal equipment and storage medium | |
TW201818699A (en) | Data transmission method, equipment, device and system | |
CN111511041B (en) | Remote connection method and device | |
CN110351394B (en) | Network data processing method and device, computer device and readable storage medium | |
CN113242550A (en) | Network distribution method, device, equipment and storage medium | |
CN114025010B (en) | Method for establishing connection and network equipment | |
CN109962917A (en) | Authentication information processing method and equipment, system, storage medium | |
US20210314329A1 (en) | Systems, methods, and media for authorizing external network access requests | |
CN111953798A (en) | Cross-network communication method, device and system and proxy server | |
CN106533985B (en) | Message forwarding method and device | |
CN113067908B (en) | NAT (network Address translation) traversing method and device, electronic equipment and storage medium | |
CN116582516B (en) | Data transmission method, device, system, medium and program product |
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 |