CN111355774B - Service communication method, device and system based on P2P - Google Patents

Service communication method, device and system based on P2P Download PDF

Info

Publication number
CN111355774B
CN111355774B CN201910708630.7A CN201910708630A CN111355774B CN 111355774 B CN111355774 B CN 111355774B CN 201910708630 A CN201910708630 A CN 201910708630A CN 111355774 B CN111355774 B CN 111355774B
Authority
CN
China
Prior art keywords
identifier
service
link
module
connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910708630.7A
Other languages
Chinese (zh)
Other versions
CN111355774A (en
Inventor
潘亚东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201910708630.7A priority Critical patent/CN111355774B/en
Publication of CN111355774A publication Critical patent/CN111355774A/en
Priority to PCT/CN2020/106333 priority patent/WO2021018297A1/en
Application granted granted Critical
Publication of CN111355774B publication Critical patent/CN111355774B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • GPHYSICS
    • G08SIGNALLING
    • G08BSIGNALLING OR CALLING SYSTEMS; ORDER TELEGRAPHS; ALARM SYSTEMS
    • G08B13/00Burglar, theft or intruder alarms
    • G08B13/18Actuation by interference with heat, light, or radiation of shorter wavelength; Actuation by intruding sources of heat, light, or radiation of shorter wavelength
    • G08B13/189Actuation by interference with heat, light, or radiation of shorter wavelength; Actuation by intruding sources of heat, light, or radiation of shorter wavelength using passive radiation detection systems
    • G08B13/194Actuation by interference with heat, light, or radiation of shorter wavelength; Actuation by intruding sources of heat, light, or radiation of shorter wavelength using passive radiation detection systems using image scanning and comparing systems
    • G08B13/196Actuation by interference with heat, light, or radiation of shorter wavelength; Actuation by intruding sources of heat, light, or radiation of shorter wavelength using passive radiation detection systems using image scanning and comparing systems using television cameras
    • G08B13/19654Details concerning communication with a camera
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/632Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing using a connection between clients on a wide area network, e.g. setting up a peer-to-peer communication via Internet for retrieving video segments from the hard-disk of other client devices

Abstract

The application relates to a service communication method, a device and a system based on P2P, belonging to the field of monitoring. The method comprises the following steps: receiving a first message, where the first message includes a first identifier and first data, the first identifier is used to identify a device and a service in the device, and the first data is used to request a service module in the device to perform an operation, the service module being used to provide the service; determining a device identifier and a service type corresponding to the service identified by the first identifier; when a P2P link exists between the devices corresponding to the device identifications, sending a second message to the devices through the P2P link, wherein the second message comprises the service types and the first data. The method and the device can reduce network delay.

Description

Service communication method, device and system based on P2P
Technical Field
The present application relates to the field of monitoring, and in particular, to a method, an apparatus, and a system for service communication based on P2P.
Background
In a business scenario of an alarm center, one alarm center manages many monitoring devices of a home or a business, and the monitoring devices may provide one or more services. The alarm center may receive an alarm from the monitoring device and the alarm center may notify the user. The user uses the terminal to request the monitoring device to provide service. For example, the monitoring device may be a camera installed at home, and may provide services such as video monitoring, and when detecting that a person enters the home, the monitoring device sends an alarm to the alarm center, and the alarm center notifies the user, and the user may use a terminal such as a mobile phone or a computer to request the monitoring device to provide a monitoring video.
The terminal may establish a peer-to-peer (P2P) link with the monitoring device, request the monitoring device to provide a service using the P2P link, and send data of the service to the terminal using the P2P link. When the terminal requests multiple services from the monitoring device, the terminal needs to establish multiple P2P links with the monitoring device, and requests a service from the monitoring device over one P2P link. When a plurality of terminals request services from the monitoring device, each terminal establishes a P2P link with the monitoring device. This results in a large number of P2P links being established by the monitoring device, which results in a large number of resources being required by the monitoring device to maintain the P2P links, which increases network latency.
Disclosure of Invention
The embodiment of the application provides a service communication method, a device and a system based on P2P, so as to reduce network delay. The technical scheme is as follows:
in one aspect, the present application provides a P2P-based service communication method, including:
receiving a first message, where the first message includes a first identifier and first data, the first identifier is used to identify a device and a service in the device, and the first data is used to request a service module in the device to perform an operation, the service module being used to provide the service;
determining a device identifier and a service type corresponding to the service identified by the first identifier;
when a P2P link exists between the devices corresponding to the device identifications, sending a second message to the devices through the P2P link, wherein the second message comprises the service types and the first data.
In another aspect, the present application provides a P2P-based service communication method, including:
a P2P module receives a second packet through a P2P link between a device and a proxy server, where the device includes the P2P module and at least one service module, each service module is used for providing a service, the second packet is sent by the proxy server when a terminal requests the device to provide a service, and the second packet includes a service type and first data of the service requested by the terminal;
the P2P module sends a fifth packet to a target service module through a second connection, where the target service module is a service module corresponding to the service type, the fifth packet includes the first data, the first data is used for the target service module to obtain second data belonging to the service, and the second connection is a virtual connection between the P2P module and the target service module.
In another aspect, the present application provides a P2P-based service communication apparatus, the apparatus comprising:
a receiving module, configured to receive a first packet, where the first packet includes a first identifier and first data, the first identifier is used to identify a device and a service in the device, and the first data is used to request a service module in the device, which is used to provide the service, to perform an operation;
a determining module, configured to determine a device identifier and a service type corresponding to the service identified by the first identifier;
a sending module, configured to send a second packet to the device through the P2P link when a P2P link exists between the devices corresponding to the device identifier, where the second packet includes the service type and the first data.
In another aspect, the present application provides a P2P-based service communication apparatus, the apparatus comprising:
a receiving module, configured to receive a second packet through a P2P link between a device and a proxy server, where the device includes the P2P module and at least one service module, each service module is used to provide a service, the second packet is sent by the proxy server when a terminal requests the device to provide the service, and the second packet includes a service type and first data of the service requested by the terminal;
a sending module, configured to send a fifth packet to a target service module through a second connection, where the target service module is a service module corresponding to the service type, the fifth packet includes the first data, the first data is used to request the target service module to perform an operation, and the second connection is a virtual connection between the P2P module and the target service module.
In another aspect, the present application provides a P2P-based service communication system comprising an apparatus as described in one aspect and an apparatus as described in another aspect.
In another aspect, the present application provides a non-transitory computer-readable storage medium for storing a computer program, which is loaded by a processor to execute the instructions of the P2P-based service method described above.
In another aspect, the present application provides an electronic device, which includes a processor and a memory, where the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the P2P-based service method described above.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
since the device identifier and the service type corresponding to the service identified by the first identifier in the first message are determined after the first message is received, when a P2P link exists between the devices corresponding to the device identifier, the second message is sent to the device through the P2P link, and the second message includes the service type and the first data, so that the device only needs to establish one P2P link, thereby avoiding establishing a large number of P2P links for the device, only needing few resources to maintain the P2P link, and avoiding the phenomenon of increasing network delay.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic structural diagram of a P2P-based service communication system according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of another P2P-based service communication system provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of another P2P-based service communication system provided in the embodiment of the present application;
fig. 4 is a flowchart of a P2P-based service communication method provided by an embodiment of the present application;
fig. 5 is a flowchart of another P2P-based service communication method provided by an embodiment of the present application;
fig. 6 is a flowchart of another P2P-based service communication method provided by an embodiment of the present application;
fig. 7 is a schematic structural diagram of a P2P-based service communication device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of another P2P-based service communication device according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a P2P-based service communication system according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a terminal according to an embodiment of the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
Referring to fig. 1, an embodiment of the present application provides a P2P-based service communication system, including:
the terminal 1, the proxy server 2 and the device 3, the device 3 may provide at least one service, the proxy server 2 may allocate a first identifier to each service in the device 3, and store the device identifier of the device 3, the service type corresponding to each service in the device 3, and the correspondence between the first identifier and the device identifier, and the correspondence between the service type and the first identifier.
For example, referring to fig. 1, the device 3 may provide three services, which are a Web (Web) service, a Real Time Streaming Protocol (RTSP) service, and a private protocol service, respectively. The proxy server 2 assigns the first identities 10080, 10554, and 18000 to the Web service, RTSP service, and private-protocol service of the device 3, respectively. Assuming that the device identifier of the device 3 is 894EAW, the first identifier "10080" corresponding to the Web service, and the service type "Web protocol" are stored in the correspondence relationship between the device identifier, the service type, and the first identifier as shown in the following table 1. The 894EAW, the first identifier "10554" corresponding to the RTSP service and the service type "RTDP protocol" are stored in the corresponding relationship between the device identifier, the service type and the first identifier as shown in the following table 1. 894EAW, a first identifier "18000" corresponding to the private protocol service and a service type "private protocol" are correspondingly stored in the corresponding relationship between the device identifier, the service type and the first identifier as shown in the following table 1.
TABLE 1
Device identification Type of service First mark
894EAW Web protocol 10080
894EAW RTSP protocol 10554
894EAW Private protocol 18000
…… …… ……
Each service in the device 3 corresponds to a service type, and the service type corresponding to the service may be a protocol type corresponding to the service. For example, the service types may be RTSP, hyperText transfer protocol (HTTP), and a private protocol, which correspond to the RTSP service, the Web service, and the private protocol service in the device 3 one to one, respectively.
Referring to fig. 1, the proxy server 2 stores therein a correspondence 22 between a device identifier and a service type and a first identifier, and a P2P module 21. The device 3 comprises a P2P module 31 and at least one service module 32, each service module 32 being for providing a service. For each service module, the service module corresponds to a service type corresponding to the service provided by the service module. For example, the device 3 shown in fig. 2 includes a Web service module 321, an RTSP service module 322, and a private protocol module 323, where the Web service module 321 is used to provide a Web service and corresponds to a service type "HTTP"; the RTSP service module 322 is used to provide RTSP services, corresponding to the service type "RTSP"; the private protocol module 323 is for providing a private protocol service, corresponding to the service type "private protocol".
Referring to fig. 2, the communication system may further include an alarm center 4, and the alarm center 4 may be connected to each device 3 and each terminal 1. The device 3 may alert the alert center 4 and the alert center 4 may inform the terminal 1 so that the terminal 1 requests communication with the device 3.
For example, the device 3 may be a camera or an access control system installed in a home, and may provide services such as video monitoring, when detecting that a person intrudes, the device 3 sends an alarm to the alarm center 4, the alarm center 4 may send a notification to the terminal 1, where the notification includes a device identifier of the device 3, and the terminal 1 may be a terminal such as a mobile phone or a computer.
After receiving the notification, the terminal 1 may send an inquiry request to the proxy server 2, where the inquiry request carries the device identifier of the device 3 and the service type corresponding to the service requested by the terminal 1. The proxy server 2 receives the query request, acquires a corresponding first identifier from the corresponding relationship between the device identifier, the service type and the first identifier according to the device identifier and the service type of the device carried in the query request, and sends a query response to the terminal 1, wherein the query response carries the first identifier.
Optionally, after receiving the query response, the terminal 1 may establish a first connection for transmitting the service corresponding to the service type with the proxy server 2.
The first connection may be a Transmission Control Protocol (TCP) connection, an HTTP connection, or the like.
The terminal 1 receives the query response, and sends a first message with a first format to the proxy server 2 through the first connection, wherein the first message comprises the first identifier and the first data.
The first identifier is used to identify the device 3 and a service in the device 3, and the first data is used to request a service module in the device 3 for providing the service to perform an operation.
The first data may be a request message for requesting the service or may be an upgrade package for upgrading the service module, for example, the request message may be a request message of a Web page, a video request message, or the like.
When the first data is a request message, a service module in the device 3 for providing the service may provide the data requested by the request message. When the first data is the upgrade package, a service module in the device 3 for providing the service is upgraded based on the first data.
Optionally, the header of the first packet includes the first identifier, and the payload portion of the first packet includes the first data.
The first format may be a real-time transport protocol (RTP) or RTSP message format.
The proxy server 2 receives the first message, acquires the service type corresponding to the service requested by the terminal 1 and the device identifier of the device 3 from the correspondence between the device identifier, the service type and the first identifier according to the first identifier, and determines whether a P2P link exists with the device 3 according to the device identifier. When a P2P link exists with the device 3, a second packet is sent to the device 3 through the P2P link, and the second packet includes the service type. When the P2P link does not exist between the device 3, a P2P link is established with the device 3, and a second message is sent to the device 3 through the established P2P link, wherein the second message includes the service type and the first data.
As an example, the proxy server 2 may store a correspondence between a device identifier and a link identifier, where each record in the correspondence includes a device identifier and a link identifier of a P2P link currently existing between devices corresponding to the device identifier. For example, referring to the correspondence between the device identifier and the link identifier shown in table 2 below, the link identifier of the P2P link in the correspondence may be the port number corresponding to the P2P link.
TABLE 2
Device identification Link identification
894EAW 10090
…… ……
In this way, the proxy server 2 may query the correspondence between the device identifier and the link identifier according to the device identifier of the device 3, determine that a P2P link corresponding to the link identifier exists between the device 3 when the corresponding link identifier is queried, and determine that a P2P link does not exist between the device 3 when the corresponding link identifier is not queried.
As an example, the proxy server 2 includes a register corresponding to the currently existing P2P link, and the register corresponding to the P2P link is used to store the device identifier of the device that establishes the P2P link with the proxy server. For example, for a device corresponding to the device identification "894 EAW," a register corresponding to the P2P link between the devices is included in proxy server 2, which holds the device identification "894 EAW.
Thus, the proxy server searches the register corresponding to the currently existing P2P link according to the device identifier of the device 3; when the register storing the device identifier of the device 3 is inquired, determining that a P2P link corresponding to the inquired register exists between the device 3 and the register; when the register holding the device identification of the device 3 is not queried, it is determined that the P2P link does not exist with the device 3.
Referring to fig. 3, the communication system further includes a P2P server 5, and the proxy server 2 establishes a P2P link with the device 3 through the P2P server 5 when it is determined that the P2P link does not exist with the device 3.
After receiving the first message, the proxy server 2 may further allocate a second identifier, where the second identifier is used to identify the terminal 1 and the service requested by the terminal 1.
The proxy server 2 stores the second identifier, the equipment identifier and the connection identifier of the first connection between the terminal 1 and the proxy server 2 in the corresponding relation of the second identifier, the equipment identifier and the connection identifier; and sending a second message in a second format to the device 3 over the P2P link, the header of the second message including the second identification and the service type, the payload portion of the second message including the first data.
The second format is different from the first format, and the second format may be a message format transmitted over a P2P link, and the first format may be a message format transmitted over the first connection.
Optionally, the P2P module 21 in the proxy server 2 may send the second packet with the second format to the device 3 through the P2P link.
The P2P module 31 of the device 3 receives the second packet through the P2P link, determines a target service module corresponding to the service type, and sends a fifth packet in the first format to the target service module through a second connection between the P2P module 31 and the target service module, where the fifth packet includes the first data, so that the target service module obtains the second data belonging to the service according to the first data, and the second connection is a virtual connection between the P2P module 31 and the target service module.
Optionally, a payload portion of the fifth packet includes the first data; the P2P module 31 stores the second identifier and the connection identifier of the second connection in the corresponding relationship between the second identifier and the connection identifier.
The connection type of the second connection is the same as the connection type of the first connection, so the first format is the same as the message format of the message transmitted on the second connection.
After receiving the fifth packet, the target service module may send second data to the terminal 1, where the second data belongs to the service of the service type, and the sending process is as follows:
the target service module sends a sixth packet in the first format to the P2P module 31 through the second connection between the P2P module 31 and the target service module, and a payload portion of the sixth packet includes the second data.
The P2P module 31 obtains a second identifier from the corresponding relationship between the second identifier and the connection identifier according to the connection identifier of the second connection; and sending a third message in the second format to the proxy server 2 through the P2P link, wherein a header of the third message includes the second identifier, and a payload part of the third message includes the second data.
The proxy server 2 receives a third message sent by the device 3 through the P2P link, where a message header of the third message includes a second identifier, and a payload part of the third message includes second data; acquiring a connection identifier of the first connection from the corresponding relation among the second identifier, the equipment identifier and the connection identifier according to the second identifier and the equipment identifier of the equipment 3; and sending a fourth message with the first format to the terminal 1 through the first connection corresponding to the connection identifier of the first connection, wherein a payload part of the fourth message comprises second data.
The connection identifier of the first connection may be a connection socket of the first connection, and the connection identifier of the second connection may be a connection socket of the second connection.
Referring to fig. 4, the present application provides a P2P-based service communication method, including:
step 101: receiving a first message, where the first message includes a first identifier and first data, the first identifier is used to identify a device and a service in the device, and the first data is used to request a service module in the device to perform an operation for providing the service.
Step 102: and determining the equipment identification and the service type corresponding to the service identified by the first identification.
Step 103: and when a P2P link exists between the devices corresponding to the device identification, sending a second message to the device through the P2P link, wherein the second message comprises the service type and the first data.
In the embodiment of the application, a first message is received, and an equipment identifier and a service type corresponding to a service identified by a first identifier in the first message are determined, so that when a P2P link exists between equipment corresponding to the equipment identifier, a second message is sent to the equipment through the P2P link, and the second message includes the service type and first data, so that the equipment only needs to establish one P2P link, and the phenomenon that network delay is increased due to the fact that a large number of P2P links are established for the equipment is avoided.
Referring to fig. 5, the present application provides a P2P-based service communication method applied to a device including a P2P module and at least one service module, each service module being for providing a service, the method including:
step 201: the P2P module receives a second message through a P2P link between the device and the proxy server, where the device includes the P2P module and at least one service module, each service module is used for providing a service, the second message is sent by the proxy server when the terminal requests the device to provide the service, and the second message includes the service type of the service requested by the terminal and the first data.
Step 202: the P2P module sends a fifth message to the target service module through the second connection, where the target service module is a service module corresponding to the service type, the fifth message includes first data, the first data is used to request the target service module to perform an operation, and the second connection is a virtual connection between the P2P module and the target service module.
In this embodiment, the P2P module receives the second packet through a P2P link between the device and the proxy server, so that the device only needs to establish a P2P link, thereby avoiding the occurrence of a phenomenon that a large number of P2P links are established for the device, which leads to an increase in network delay.
Referring to fig. 6, the present application provides a P2P-based service communication method, which can be applied to the communication system shown in fig. 1, and includes:
step 301: and the terminal sends a query request to the proxy server, wherein the query request carries the equipment identifier of the equipment and the service type corresponding to the service requested by the terminal.
Referring to fig. 2, the communication system includes an alarm center that can receive alarms from devices and notify a user to have the user process the alarms from the devices. For example, the alarm center sends a notification to the terminal corresponding to the user, where the notification includes the device identification of the device.
The terminal receives the notification and displays the notification to the user. The user may input to the terminal a service type corresponding to the service provided by the requesting device. And the terminal sends a query request to the proxy server through the first connection, wherein the query request carries the equipment identifier of the equipment and the service type corresponding to the service requested by the terminal.
Step 302: and the proxy server receives the query request, acquires the first identifier according to the equipment identifier and the service type carried by the query request, and sends a query response to the monitoring terminal, wherein the query response carries the first identifier.
The first identifier is used for identifying the device and a service provided in the device corresponding to the service type. The proxy server may allocate a first identifier to each service in the device in advance, and store the device identifier of the device, the service type corresponding to each service in the device, and the correspondence of the first identifier in the correspondence between the device identifier, the service type, and the first identifier.
Optionally, the device may send, when the device is powered on and started, a registration request message for allocating the first identifier to the proxy server, where the registration request message includes a service type corresponding to each service in the device. And the proxy server receives the registration request message, and allocates a first identifier for each service in the equipment according to the service type corresponding to each service in the equipment, wherein the first identifier of the service can uniquely identify the service in the proxy server.
As an example, the first identifier assigned to the service may be a port number. The proxy server may establish a first connection with the terminal based on the port number. The first connection between the terminal and the proxy server may be a TCP connection or an RTSP connection, etc.
In this step, the proxy server obtains a corresponding first identifier from the correspondence between the device identifier, the service type, and the first identifier according to the device identifier and the service type carried in the query request, and sends a query response to the terminal, where the query response carries the first identifier.
And after receiving the first identifier, the terminal sends a message to the equipment by using the first identifier. The detailed implementation process is as follows:
step 303: the terminal sends a first message to the proxy server, wherein the first message comprises a first identifier and first data.
The header of the first message may include a first identification and the payload portion of the first message may include the first data.
The header of the first message includes a port number field, and the port number field carries the first identifier.
The message format of the first message is a first format, and the first format may be a message format of RTP or RTSP.
The first identification is used to identify a device and a service in the device. The first data may be for requesting a service module in the device for providing the service to perform an operation.
The first data may be a request message, which may be a request message for a Web page, a video request message, etc. The first data is for requesting the service module to provide data belonging to the service. Alternatively, the first and second electrodes may be,
the first data is an upgrade package used for upgrading the service module, and the first data is used for requesting the service module to be upgraded.
Referring to table 3 below, a header and a payload part of a first packet in a first format, where the header of the first packet includes an internet protocol address (IP) header and a TCP header.
TABLE 3
IP header TCP head Payload section
The first format may be a message format of a message transmitted over the first connection. The first format may be a message format of the RTP or RTSP protocol. The terminal may send a first message in a first format to the proxy server over the first connection.
Step 304: and the proxy server receives the first message and determines the equipment identifier and the service type corresponding to the service identified by the first identifier.
In this step, the proxy server may obtain, according to the first identifier, the service type and the device identifier corresponding to the service requested by the terminal from the correspondence between the first identifier and the service type and device identifier.
For example, assuming that the header of the first packet includes the first identifier 10554, the proxy server obtains, according to the first identifier 10554, the device identifier "894 EAW" and the service type of the corresponding device as the RTSP protocol from the correspondence between the device identifier, the service type and the first identifier shown in table 1.
Step 305: the proxy server allocates a second identifier for identifying the terminal and the service requested by the terminal.
The terminal may request the device to provide multiple services and the proxy server may transmit messages over the P2P link requesting each service. Alternatively, multiple terminals may request the device to provide the service, and the proxy server may transmit a message over the P2P link for each terminal requesting the service. The one P2P link can be used to transmit data of a plurality of services or data of a service requested by a plurality of terminals. For each service requested by a terminal, the terminal and the service provided by the terminal may be identified using the second identifier, so that different services requested by different terminals may be distinguished using the second identifier to implement transmission of data of multiple services or data of multiple services requested by the terminal over the one P2P link.
Step 306: and the proxy server stores the second identifier, the equipment identifier and the connection identifier of the first connection between the terminal and the proxy server in the corresponding relation of the second identifier, the equipment identifier and the connection identifier.
Alternatively, the connection identifier of the first connection may be a connection socket of the first connection, or the like.
Step 307: the proxy server determines whether a P2P link exists with the device according to the device identifier, and if a P2P link exists with the device, the following step 308 is executed, and if a P2P link does not exist with the device, a P2P link with the device is established.
The proxy server may store a correspondence between the device identifier and the link identifier, where each record in the correspondence includes a device identifier and a link identifier of a currently existing P2P link between devices corresponding to the device identifier.
Thus, in this step: the proxy server may query a correspondence between the device identifier and the link identifier according to the device identifier of the device, determine that a P2P link corresponding to the link identifier exists between the proxy server and the device when the corresponding link identifier is queried, and determine that a P2P link does not exist between the proxy server and the device when the corresponding link identifier is not queried. Alternatively, the first and second electrodes may be,
the proxy server includes a register corresponding to the currently existing P2P link, and the register corresponding to the P2P link is used for storing the device identifier of the device establishing the P2P link with the proxy server.
Thus, in this step: the proxy server searches a register corresponding to the current existing P2P link according to the equipment identifier of the equipment; when a register storing the device identifier of the device is inquired, determining that a P2P link corresponding to the inquired register exists between the devices; when the register storing the device identification of the device is not queried, it is determined that no P2P link exists with the device.
Step 308: the proxy server sends a second message to the device over the P2P link, the second message including the second identification, the service type, and the first data.
The header of the second packet includes the second identifier and the service type, and the payload portion of the second packet includes the first data.
The message format of the second message may be a second format, the first format being different from the second format, and the second format may be a message format for transmission over a P2P link.
Referring to table 4 below, the header and payload portions of the second packet in the second format include an IP header, a User Datagram Protocol (UDP) header, a P2P header, and a proxy protocol header. The second identification and the service type may be included in a proxy protocol header.
TABLE 4
IP header UDP header P2P head Proxy protocol header Payload section
Step 309: the P2P module of the device receives the second packet through the P2P link, determines a target service module corresponding to the service type, and sends a fifth packet to the target service module through the second connection between the P2P module and the target service module.
Optionally, the payload part of the fifth packet includes the first data.
After the P2P module determines the target service module corresponding to the service type, a second connection between the P2P module and the target service module is established, and the second connection is used for transmitting data belonging to the service currently requested by the terminal.
The second connection may be a virtual connection, etc.
The message format of the fifth message is the first format, and can be transmitted on the second connection between the P2P module and the target service module.
Step 310: the P2P module stores the second identifier and the connection identifier of the second connection in the corresponding relationship between the second identifier and the connection identifier.
The connection identification of the second connection may be a connection socket of the second connection, etc.
And the target service module receives the fifth message and executes operation according to the first data included in the payload part of the fifth message.
When the first data is a request message for requesting the service, the target service module acquires second data belonging to the service according to the first data, and sends a sixth message in the first format to the P2P module through the second connection, where a payload portion of the sixth message includes the second data. Alternatively, the first and second electrodes may be,
and when the first data is an upgrade package used for upgrading the target service module, the target service module is upgraded according to the upgrade package. After the upgrade is finished, the target service module may send a sixth packet in the first format to the P2P module through the second connection, where a payload portion of the sixth packet includes second data, and the second data is an upgrade result.
Step 311: the P2P module receives the sixth message sent by the target service module through the second connection with the target service module.
Step 312: and the P2P module obtains the second identifier from the corresponding relationship between the second identifier and the connection identifier according to the connection identifier of the second connection.
Step 313: the P2P module sends a third message in the second format to the proxy server over the P2P link, the third message including the device identifier of the device, the second identifier, and the second data.
The header of the third packet may include the second identification and the payload portion of the third packet may include the second data.
Step 314: the proxy server receives the third message through the P2P link, and obtains the connection identifier of the first connection from the corresponding relationship among the second identifier, the device identifier, and the connection identifier according to the second identifier included in the third message and the device identifier of the device.
Step 315: and the proxy server sends a fourth message with the first format to the terminal through the first connection corresponding to the connection identifier of the first connection, wherein the payload part of the fourth message comprises second data.
The terminal receives the fourth message from the first connection.
In this embodiment of the present application, when the proxy server receives the first packet sent by the terminal, the proxy server allocates the second identifier for identifying the terminal and the service requested by the terminal, and stores the second identifier, the device identifier, and the connection identifier of the first connection in the correspondence between the second identifier and the device identifier and the connection identifier. The proxy server sends the second packet including the second identifier and the service type to the device through the P2P link, so that the device sends the third packet to the proxy server, where the third packet may include the device identifier and the second identifier, and after receiving the third packet, the proxy server may obtain the connection identifier of the first connection based on the device identifier and the second identifier, and then send the packet to the monitoring terminal based on the first connection corresponding to the connection identifier. Therefore, a plurality of services requested by the terminal or services requested by a plurality of terminals transmitted on the P2P link between the proxy server and the equipment can be distinguished through the first identifier, so that the equipment only needs to establish one P2P link, and the phenomenon that network delay is increased due to the fact that a large number of P2P links are established for the equipment is avoided.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 7, an embodiment of the present application provides a service communication apparatus 400 based on P2P, where the apparatus 400 may be deployed in a proxy server provided in any of the above embodiments, and includes:
a receiving module 401, configured to receive a first packet, where the first packet includes a first identifier and first data, the first identifier is used to identify a device and a service in the device, and the first data is used to request a service module in the device, which is used to provide the service, to perform an operation;
a determining module 402, configured to determine a device identifier and a service type corresponding to the service identified by the first identifier;
a sending module 403, configured to send, when a P2P link exists between devices corresponding to the device identifier, a second packet to the device through the P2P link, where the second packet includes the service type and the first data.
Optionally, the apparatus 400 further includes:
an establishing module, configured to establish a P2P link with a device corresponding to the device identifier when the P2P link does not exist between the devices;
the sending module 403 is further configured to send the second packet to the device through the established P2P link.
Optionally, the apparatus 400 further includes:
a first query module, configured to query, according to a device identifier of the device, a correspondence between the device identifier and a link identifier, where each record in the correspondence includes a device identifier and a link identifier of a P2P link currently existing between devices corresponding to the device identifier; and when the corresponding link identification is inquired, determining that a P2P link corresponding to the link identification exists between the equipment, and when the corresponding link identification is not inquired, determining that a P2P link does not exist between the equipment.
Optionally, the apparatus further comprises:
the second query module is used for querying a register corresponding to a currently existing P2P link according to the equipment identifier of the equipment; when a register storing the device identifier of the device is inquired, determining that a P2P link corresponding to the inquired register exists between the device and the device; and when the register storing the device identification of the device is not inquired, determining that a P2P link does not exist between the device and the device.
Optionally, the second packet further includes a second identifier, where the second identifier is used to identify the terminal and the service that send the first packet; the apparatus 400 further comprises:
and the first storage module is used for distributing the second identifier and storing the second identifier, the equipment identifier and the connection identifier of the first connection in the corresponding relation among the first identifier, the equipment identifier and the connection identifier, wherein the first connection is used for transmitting the first message between the terminals.
Optionally, the apparatus 400 further comprises an obtaining module,
the receiving module 401 is further configured to receive a third packet sent by the device through the P2P link, where the third packet includes the second identifier, the device identifier of the device, and second data belonging to the service;
the determining module is configured to obtain a connection identifier of the first connection from a corresponding relationship between the second identifier and the connection identifier according to the second identifier and the device identifier of the device;
the sending module 403 is further configured to send the fourth packet to the terminal through the first connection corresponding to the connection identifier, where the fourth packet includes the second data.
Optionally, the packet formats of the first packet and the third packet are a first format, and the first format is a packet format transmitted over the first connection;
the message format of the second message is a second format, the second format is a message format transmitted on the P2P link, and the first format is different from the second format.
Optionally, the apparatus 400 further includes: a second storage module for storing the data of the first storage module,
the receiving module 401 is further configured to receive a registration request message sent by the device, where the registration request message includes a device identifier of the device and a service type of a service provided by the device;
the second storage module is configured to allocate a first identifier, and store the first identifier, the device identifier of the device, and the service type of the service provided by the device in a corresponding relationship among the first identifier, the device identifier, and the service type.
In this embodiment of the present application, when receiving a first packet sent by a receiving terminal, a determining module allocates a second identifier for identifying a service requested by the terminal and the terminal, and a storing module stores the second identifier, the device identifier, and a connection identifier of the first connection in a corresponding relationship between the second identifier and the device identifier and the connection identifier. Thus, after the sending module sends the second packet including the second identifier, the service type, and the first data to the device through the P2P link, if the receiving module receives the packet carrying the device identifier and the second identifier returned by the device, the receiving module may obtain the connection identifier of the first connection based on the device identifier and the second identifier, and send the packet to the terminal based on the first connection corresponding to the connection identifier. Therefore, a plurality of services requested by the terminal or services requested by a plurality of terminals transmitted on the P2P link between the proxy server and the equipment can be distinguished through the second identifier, so that the equipment only needs to establish one P2P link, and the phenomenon that network delay is increased due to the fact that a large number of P2P links are established for the equipment is avoided.
Referring to fig. 8, an embodiment of the present application provides a P2P-based service communication apparatus 500, where the apparatus 500 is used for a device including the apparatus 500 and at least one service module, each service module is used for providing a service, and the apparatus 500 includes:
a receiving module 501, configured to receive a second packet through a P2P link between a device and a proxy server, where the second packet is sent by the proxy server when a terminal requests the device to provide a service, and the second packet includes a service type of the service requested by the terminal and first data;
a sending module 502, configured to send a fifth packet to a target service module through a second connection, where the target service module is a service module corresponding to the service type, the fifth packet includes the first data, the first data is used to request the target service module to execute an operation, and the second connection is a virtual connection with the target service module.
Optionally, the header of the second packet further includes a second identifier, where the second identifier is used to identify the terminal and the service requested by the terminal; the apparatus 500 further comprises:
and the storage module is used for storing the second identifier and the connection identifier of the second connection in the corresponding relation between the second identifier and the connection identifier.
Optionally, the apparatus 500 further comprises an obtaining module,
the receiving module 501 is further configured to receive a sixth packet through the second connection, where the sixth packet includes the second data;
the acquisition module is used for acquiring the second identifier from the corresponding relation between the second identifier and the connection identifier according to the connection identifier of the second connection;
the sending module 502 is further configured to send a third packet to the proxy server through the P2P link, where the third packet includes the device identifier of the device, the second identifier, and the second data.
Optionally, the message formats of the fifth message and the sixth message are a first format, and the first format is a message format transmitted over the second connection;
the message format of the second message is a second format, the second format is a message format transmitted on the P2P link, and the first format is different from the second format.
In this embodiment of the application, the receiving module receives a second packet including a second identifier and a service type through a P2P link between the device and the proxy server, so that when the packet is sent to the proxy server, the packet may include the device identifier and the second identifier, so that the proxy server may obtain a connection identifier of the first connection based on the device identifier and the second identifier, and send the packet to the monitoring terminal based on the first connection corresponding to the connection identifier. In this way, the second identifier is used for identifying the terminal and the service requested by the terminal, so that a plurality of services requested by the terminal or services requested by a plurality of terminals transmitted on the P2P link between the proxy server and the device can be distinguished through the second identifier, and the device only needs to establish one P2P link, thereby avoiding the phenomenon that a large number of P2P links are established for the device, which causes the increase of network delay.
Referring to fig. 9, an embodiment of the present application provides a communication system 600, where the system 600 includes the apparatus shown in fig. 6 and the apparatus shown in fig. 7. The apparatus as described in fig. 6 may be a proxy server 601 and the apparatus as described in fig. 7 may be a device 602.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 10 is a block diagram illustrating a terminal 700 according to an exemplary embodiment of the present invention. The terminal 700 may be a monitoring terminal, such as: a smartphone, a tablet, a laptop, or a desktop computer. Terminal 700 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and so on.
In general, terminal 700 includes: a processor 701 and a memory 702.
The processor 701 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 701 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 701 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 701 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 701 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 702 may include one or more computer-readable storage media, which may be non-transitory. Memory 702 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 702 is used to store at least one instruction for execution by processor 701 to implement a method of communication as provided by method embodiments herein.
In some embodiments, the terminal 700 may further optionally include: a peripheral interface 703 and at least one peripheral. The processor 701, the memory 702, and the peripheral interface 703 may be connected by buses or signal lines. Various peripheral devices may be connected to peripheral interface 703 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 704, touch screen display 705, camera 706, audio circuitry 707, positioning components 708, and power source 709.
The peripheral interface 703 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 701 and the memory 702. In some embodiments, processor 701, memory 702, and peripheral interface 703 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 701, the memory 702, and the peripheral interface 703 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
The Radio Frequency circuit 704 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 704 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 704 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 704 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 704 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 704 may also include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 705 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 705 is a touch display screen, the display screen 705 also has the ability to capture touch signals on or over the surface of the display screen 705. The touch signal may be input to the processor 701 as a control signal for processing. At this point, the display 705 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 705 may be one, providing the front panel of the terminal 700; in other embodiments, the display 705 can be at least two, respectively disposed on different surfaces of the terminal 700 or in a folded design; in still other embodiments, the display 705 may be a flexible display disposed on a curved surface or on a folded surface of the terminal 700. Even more, the display 705 may be arranged in a non-rectangular irregular pattern, i.e. a shaped screen. The Display 705 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or the like.
The camera assembly 706 is used to capture images or video. Optionally, camera assembly 706 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 706 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuitry 707 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 701 for processing or inputting the electric signals to the radio frequency circuit 704 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 700. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 701 or the radio frequency circuit 704 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, the audio circuitry 707 may also include a headphone jack.
The positioning component 708 is used to locate the current geographic Location of the terminal 700 for navigation or LBS (Location Based Service). The Positioning component 708 can be a Positioning component based on the Global Positioning System (GPS) in the united states, the beidou System in china, or the galileo System in russia.
Power supply 709 is provided to supply power to various components of terminal 700. The power source 709 may be alternating current, direct current, disposable batteries, or rechargeable batteries. When the power source 709 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 700 also includes one or more sensors 710. The one or more sensors 710 include, but are not limited to: acceleration sensor 711, gyro sensor 712, pressure sensor 713, fingerprint sensor 714, optical sensor 715, and proximity sensor 716.
The acceleration sensor 711 can detect the magnitude of acceleration in three coordinate axes of a coordinate system established with the terminal 700. For example, the acceleration sensor 711 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 701 may control the touch screen 705 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 711. The acceleration sensor 711 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 712 may detect a body direction and a rotation angle of the terminal 700, and the gyro sensor 712 may cooperate with the acceleration sensor 711 to acquire a 3D motion of the terminal 700 by the user. From the data collected by the gyro sensor 712, the processor 701 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
Pressure sensors 713 may be disposed on a side bezel of terminal 700 and/or an underlying layer of touch display 705. When the pressure sensor 713 is disposed on a side frame of the terminal 700, a user's grip signal on the terminal 700 may be detected, and the processor 701 performs right-left hand recognition or shortcut operation according to the grip signal collected by the pressure sensor 713. When the pressure sensor 713 is disposed at a lower layer of the touch display 705, the processor 701 controls the operability control on the UI interface according to the pressure operation of the user on the touch display 705. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 714 is used for collecting a fingerprint of a user, and the processor 701 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 714, or the fingerprint sensor 714 identifies the identity of the user according to the collected fingerprint. When the user identity is identified as a trusted identity, the processor 701 authorizes the user to perform relevant sensitive operations, including unlocking a screen, viewing encrypted information, downloading software, paying, changing settings, and the like. The fingerprint sensor 714 may be disposed on the front, back, or side of the terminal 700. When a physical button or a vendor Logo is provided on the terminal 700, the fingerprint sensor 714 may be integrated with the physical button or the vendor Logo.
The optical sensor 715 is used to collect the ambient light intensity. In one embodiment, the processor 701 may control the display brightness of the touch display 705 based on the ambient light intensity collected by the optical sensor 715. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 705 is increased; when the ambient light intensity is low, the display brightness of the touch display 705 is turned down. In another embodiment, processor 701 may also dynamically adjust the shooting parameters of camera assembly 706 based on the ambient light intensity collected by optical sensor 715.
A proximity sensor 716, also referred to as a distance sensor, is typically disposed on a front panel of the terminal 700. The proximity sensor 716 is used to collect the distance between the user and the front surface of the terminal 700. In one embodiment, when the proximity sensor 716 detects that the distance between the user and the front surface of the terminal 700 gradually decreases, the processor 701 controls the touch display 705 to switch from the bright screen state to the dark screen state; when the proximity sensor 716 detects that the distance between the user and the front surface of the terminal 700 gradually becomes larger, the processor 701 controls the touch display 705 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 10 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (19)

1. A method for P2P-based service communication, the method comprising:
the method comprises the steps that a proxy server receives a first message from a terminal, wherein the first message comprises a first identifier and first data, the first identifier is used for identifying a device and a service in the device, and the first data is used for requesting a service module in the device for providing the service to execute operation;
the proxy server determines a device identifier and a service type corresponding to the service identified by the first identifier;
when a P2P link exists between devices corresponding to the device identifier, the proxy server sends a second packet to the device through the P2P link, where the second packet includes the service type and the first data, and the second packet further includes a second identifier, where the second identifier is used to identify a terminal sending the first packet and the service, and the second identifier is used to distinguish different services requested by different terminals, so as to enable data of multiple services or data of multiple services requested by multiple terminals to be transmitted over the P2P link.
2. The method of claim 1, wherein the method further comprises:
and when no P2P link exists between the equipment corresponding to the equipment identification, establishing a P2P link between the equipment and sending the second message to the equipment through the established P2P link.
3. The method of claim 1, wherein prior to sending the second message to the device over the P2P link, further comprising:
inquiring the corresponding relation between the equipment identification and the link identification according to the equipment identification of the equipment, wherein each record in the corresponding relation comprises the equipment identification and the link identification of the currently existing P2P link between the equipment corresponding to the equipment identification; when the corresponding link identification is inquired, determining that a P2P link corresponding to the link identification exists between the equipment, and when the corresponding link identification is not inquired, determining that a P2P link does not exist between the equipment; alternatively, the first and second electrodes may be,
inquiring a register corresponding to a currently existing P2P link according to the equipment identifier of the equipment; when a register storing the device identifier of the device is inquired, determining that a P2P link corresponding to the inquired register exists between the device and the device; and when the register storing the device identification of the device is not inquired, determining that a P2P link does not exist between the device and the device.
4. The method of claim 1, wherein the method further comprises:
and distributing the second identifier, and storing the second identifier, the equipment identifier and the connection identifier of the first connection in the corresponding relation among the second identifier, the equipment identifier and the connection identifier, wherein the first connection is used for transmitting the first message between the terminal and the first connection.
5. The method of claim 4, wherein after sending the second message to the device over the P2P link, further comprising:
receiving a third message sent by the device through the P2P link, where the third message includes the second identifier, the device identifier of the device, and second data belonging to the service;
acquiring a connection identifier of the first connection from the corresponding relation among the second identifier, the device identifier and the connection identifier according to the second identifier and the device identifier of the device;
and sending a fourth message to the terminal through the first connection corresponding to the connection identifier, wherein the fourth message comprises the second data.
6. The method of any of claims 1 to 5, wherein prior to obtaining the service type of the service and the device identification of the device, further comprising:
receiving a registration request message sent by the device, wherein the registration request message comprises a device identifier of the device and a service type of a service provided by the device;
allocating a first identifier, and correspondingly storing the first identifier, the equipment identifier of the equipment and the service type of the service provided by the equipment in the corresponding relation of the first identifier, the equipment identifier and the service type.
7. A method for P2P-based service communication, the method comprising:
a P2P module receives a second packet through a P2P link between a device and a proxy server, where the device includes the P2P module and at least one service module, each service module is used to provide a service, the second packet is sent by the proxy server when a terminal requests the device to provide a service, the second packet includes a service type and first data of the service requested by the terminal, the second packet further includes a second identifier, the second identifier is used to identify the terminal sending the first packet and the service, and the second identifier is used to distinguish different services requested by different terminals, so as to enable data of multiple services or data of multiple services requested by multiple terminals to be transmitted over the P2P link;
the P2P module sends a fifth message to a target service module through a second connection, where the target service module is a service module corresponding to the service type, the fifth message includes the first data, the first data is used to request the target service module to perform an operation, and the second connection is a virtual connection between the P2P module and the target service module.
8. The method of claim 7, wherein;
after the P2P module receives the second packet through the P2P link between the device and the proxy server, the method further includes:
and the P2P module correspondingly stores the second identifier and the connection identifier of the second connection in the corresponding relationship between the second identifier and the connection identifier.
9. The method of claim 8, wherein after the P2P module sends the fifth message to the target service module over the second connection, further comprising:
the P2P module receives a sixth packet through the second connection, where the sixth packet includes the second data;
the P2P module obtains the second identifier from the corresponding relationship between the second identifier and the connection identifier according to the connection identifier of the second connection;
the P2P module sends a third message to the proxy server over the P2P link, the third message including the device identification of the device, the second identification, and the second data.
10. A P2P-based service communication device, the device comprising:
a receiving module, configured to receive a first packet from a terminal, where the first packet includes a first identifier and first data, the first identifier is used to identify a device and a service in the device, and the first data is used to request a service module in the device, which is used to provide the service, to perform an operation;
a determining module, configured to determine a device identifier and a service type corresponding to the service identified by the first identifier;
a sending module, configured to send, when a P2P link exists between devices corresponding to the device identifier, a second packet to the device through the P2P link, where the second packet includes the service type and the first data, and the second packet further includes a second identifier, where the second identifier is used to identify a terminal that sends the first packet and the service, and the second identifier is used to distinguish different services requested by different terminals, so as to enable data of multiple services or data of multiple services requested by multiple terminals to be transmitted over the P2P link.
11. The apparatus of claim 10, wherein the apparatus further comprises:
an establishing module, configured to establish a P2P link with a device corresponding to the device identifier when the P2P link does not exist between the devices;
the sending module is further configured to send the second packet to the device through the established P2P link.
12. The apparatus of claim 10, wherein the apparatus further comprises:
a first query module, configured to query, according to a device identifier of the device, a correspondence between the device identifier and a link identifier, where each record in the correspondence includes a device identifier and a link identifier of a P2P link currently existing between devices corresponding to the device identifier; when the corresponding link identification is inquired, determining that a P2P link corresponding to the link identification exists between the equipment, and when the corresponding link identification is not inquired, determining that a P2P link does not exist between the equipment; alternatively, the first and second electrodes may be,
the second query module is used for querying a register corresponding to a currently existing P2P link according to the equipment identifier of the equipment; when a register storing the device identifier of the device is inquired, determining that a P2P link corresponding to the inquired register exists between the device and the device; and when the register storing the device identification of the device is not inquired, determining that a P2P link does not exist between the device and the device.
13. The apparatus of claim 10, wherein the apparatus further comprises:
and the first storage module is used for distributing the second identifier and storing the second identifier, the equipment identifier and the connection identifier of the first connection in the corresponding relation among the second identifier, the equipment identifier and the connection identifier, wherein the first connection is used for transmitting the first message between the terminals.
14. The apparatus of claim 13, wherein the apparatus further comprises an acquisition module,
the receiving module is further configured to receive a third packet sent by the device through the P2P link, where the third packet includes the second identifier, the device identifier of the device, and second data belonging to the service;
the obtaining module is configured to obtain, according to the second identifier and the device identifier of the device, a connection identifier of the first connection from a correspondence between the second identifier and the device identifier and the connection identifier;
the sending module is further configured to send a fourth packet to the terminal through the first connection corresponding to the connection identifier, where the fourth packet includes the second data.
15. The apparatus of any of claims 10 to 14, further comprising: a second storage module for storing the data of the first storage module,
the receiving module is further configured to receive a registration request message sent by the device, where the registration request message includes a device identifier of the device and a service type of a service provided by the device;
the second storage module is configured to allocate a first identifier, and store the first identifier, the device identifier of the device, and the service type of the service provided by the device in a corresponding relationship among the first identifier, the device identifier, and the service type.
16. A P2P-based service communication device, the device comprising:
a receiving module, configured to receive a second packet through a P2P link between a device and a proxy server, where the device includes at least one service module, each service module is configured to provide a service, the second packet is sent by the proxy server when a terminal requests the device to provide the service, the second packet includes a service type and first data of the service requested by the terminal, the second packet further includes a second identifier, the second identifier is configured to identify the terminal and the service that send the first packet, and the second identifier is configured to distinguish different services requested by different terminals, so that data of multiple services or data of multiple services requested by multiple terminals can be transmitted over the P2P link;
the sending module is configured to send a fifth packet to a target service module through a second connection, where the target service module is a service module corresponding to the service type, the fifth packet includes the first data, the first data is used to request the target service module to execute an operation, and the second connection is a virtual connection with the target service module.
17. The apparatus of claim 16, wherein the apparatus further comprises:
and the storage module is used for storing the second identifier and the connection identifier of the second connection in the corresponding relation between the second identifier and the connection identifier.
18. The apparatus of claim 17, wherein the apparatus further comprises an acquisition module,
the receiving module is further configured to receive a sixth packet through the second connection, where the sixth packet includes the second data;
the acquisition module is used for acquiring the second identifier from the corresponding relation between the second identifier and the connection identifier according to the connection identifier of the second connection;
the sending module is further configured to send a third packet to the proxy server through the P2P link, where the third packet includes the device identifier of the device, the second identifier, and the second data.
19. A P2P-based service communication system, characterized in that the system comprises the apparatus according to any of claims 10 to 15 and the apparatus according to any of claims 16 to 18.
CN201910708630.7A 2019-08-01 2019-08-01 Service communication method, device and system based on P2P Active CN111355774B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910708630.7A CN111355774B (en) 2019-08-01 2019-08-01 Service communication method, device and system based on P2P
PCT/CN2020/106333 WO2021018297A1 (en) 2019-08-01 2020-07-31 P2p-based service communication method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910708630.7A CN111355774B (en) 2019-08-01 2019-08-01 Service communication method, device and system based on P2P

Publications (2)

Publication Number Publication Date
CN111355774A CN111355774A (en) 2020-06-30
CN111355774B true CN111355774B (en) 2021-10-29

Family

ID=71196773

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910708630.7A Active CN111355774B (en) 2019-08-01 2019-08-01 Service communication method, device and system based on P2P

Country Status (2)

Country Link
CN (1) CN111355774B (en)
WO (1) WO2021018297A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111355774B (en) * 2019-08-01 2021-10-29 杭州海康威视数字技术股份有限公司 Service communication method, device and system based on P2P
CN113055494B (en) * 2021-03-30 2022-11-29 中国工商银行股份有限公司 Communication method and communication device
CN114679496B (en) * 2022-02-17 2024-03-22 上海生慧樘科技有限公司 User screening method based on cloud service processing
CN114679471B (en) * 2022-02-17 2023-09-01 人民日报媒体技术股份有限公司 Data matching method based on cloud service processing
CN115118772A (en) * 2022-06-21 2022-09-27 壹沓科技(上海)有限公司 Message communication system and method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101616169A (en) * 2008-06-23 2009-12-30 华为技术有限公司 Select service that method, system, services selection entity, the Service Management entity of entity are provided
CN102170422A (en) * 2010-02-25 2011-08-31 腾讯科技(深圳)有限公司 Method, device and system for inquiring node
CN103533039A (en) * 2013-09-27 2014-01-22 深圳市瑞彩电子技术有限公司 P2P (Peer-to-Peer) data transmission method, forwarding proxy server and system
CN108683699A (en) * 2018-03-29 2018-10-19 广州华多网络科技有限公司 The method and apparatus of forwarding service request

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2239923B1 (en) * 2009-04-09 2011-08-24 Research In Motion Limited Relay access node with separate control and transport signaling for session-based communications
CN102790803A (en) * 2012-07-19 2012-11-21 南京邮电大学 Streaming media service multi-stream concurrent transmission method based on multi-terminal fusion
CN104041095B (en) * 2012-08-22 2018-05-11 华为技术有限公司 Deep message detection analysis result shares/acquisition methods, system and its relevant device
US10200370B2 (en) * 2015-03-20 2019-02-05 Canon Information And Imaging Solutions, Inc. Apparatus, system, and method for authorizing a service
CN105898750A (en) * 2016-05-27 2016-08-24 北京奇虎科技有限公司 WiFi access point equipment and WiFi access authentication method and device
CN108900549A (en) * 2018-08-15 2018-11-27 深圳区块大陆科技有限公司 A kind of safe block chain networking technology
CN111355774B (en) * 2019-08-01 2021-10-29 杭州海康威视数字技术股份有限公司 Service communication method, device and system based on P2P

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101616169A (en) * 2008-06-23 2009-12-30 华为技术有限公司 Select service that method, system, services selection entity, the Service Management entity of entity are provided
CN102170422A (en) * 2010-02-25 2011-08-31 腾讯科技(深圳)有限公司 Method, device and system for inquiring node
CN103533039A (en) * 2013-09-27 2014-01-22 深圳市瑞彩电子技术有限公司 P2P (Peer-to-Peer) data transmission method, forwarding proxy server and system
CN108683699A (en) * 2018-03-29 2018-10-19 广州华多网络科技有限公司 The method and apparatus of forwarding service request

Also Published As

Publication number Publication date
CN111355774A (en) 2020-06-30
WO2021018297A1 (en) 2021-02-04

Similar Documents

Publication Publication Date Title
CN111225042B (en) Data transmission method and device, computer equipment and storage medium
CN111355774B (en) Service communication method, device and system based on P2P
CN110362328B (en) OTA (over the air) upgrading method and device and computer equipment
CN110278464B (en) Method and device for displaying list
WO2020001564A1 (en) Method, apparatus, and system for processing tasks
CN108848492B (en) Method, device, terminal and storage medium for starting user identity identification card
CN110636144A (en) Data downloading method and device
CN111159604A (en) Picture resource loading method and device
CN110704324A (en) Application debugging method and device and storage medium
CN111131392A (en) Method, device, electronic equipment and medium for processing message
CN110086814B (en) Data acquisition method and device and storage medium
CN112910722B (en) Network request testing method, device, terminal and storage medium
CN111008083B (en) Page communication method and device, electronic equipment and storage medium
CN111324293B (en) Storage system, data storage method, data reading method and device
CN109688064B (en) Data transmission method and device, electronic equipment and storage medium
CN111881423A (en) Method, device and system for limiting function use authorization
CN110366044B (en) Method, device and system for acquiring target object
CN107800720B (en) Hijacking reporting method, device, storage medium and equipment
CN110597840A (en) Partner relationship establishing method, device, equipment and storage medium based on block chain
CN114785766A (en) Control method of intelligent equipment, terminal and server
CN111694521B (en) Method, device and system for storing file
CN111064657B (en) Method, device and system for grouping concerned accounts
CN112260845A (en) Method and device for accelerating data transmission
CN111741040A (en) Connection establishing method, address obtaining method, device, equipment and storage medium
CN113158099A (en) Page display method and device and storage medium

Legal Events

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