CN115776493A - Resource request method, system, device, equipment and storage medium - Google Patents

Resource request method, system, device, equipment and storage medium Download PDF

Info

Publication number
CN115776493A
CN115776493A CN202111045623.7A CN202111045623A CN115776493A CN 115776493 A CN115776493 A CN 115776493A CN 202111045623 A CN202111045623 A CN 202111045623A CN 115776493 A CN115776493 A CN 115776493A
Authority
CN
China
Prior art keywords
electronic device
resource
connection
information
electronic
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.)
Pending
Application number
CN202111045623.7A
Other languages
Chinese (zh)
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.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Cloud Computing Technologies 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 Huawei Cloud Computing Technologies Co Ltd filed Critical Huawei Cloud Computing Technologies Co Ltd
Priority to CN202111045623.7A priority Critical patent/CN115776493A/en
Priority to PCT/CN2022/093659 priority patent/WO2023035660A1/en
Publication of CN115776493A publication Critical patent/CN115776493A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/251Translation of Internet protocol [IP] addresses between different IP versions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • 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
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a resource request method, a system, a device, equipment and a computer readable storage medium, belonging to the technical field of network communication. According to the method, the first electronic device sends the resource obtaining request to the management server to obtain the device information of the second electronic device stored with the requested resource, so that the connection established between the first electronic device and the second electronic device can be multiplexed, the required resource is requested from the second electronic device, the first electronic device and the second electronic device can request the resource without establishing multiple connections, and the corresponding NAT penetration is not required to be repeated for multiple times because multiple connections are not required to be established, so that the purposes of saving network resources and reducing the time consumption for establishing the connection are achieved.

Description

Resource request method, system, device, equipment and storage medium
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a resource request method, system, apparatus, device, and storage medium.
Background
A peer to peer (P2P) network technology is a network technology for resource sharing, and a P2P network includes a P2P server and a plurality of electronic devices, each electronic device learns resources stored on other electronic devices by communicating with the P2P server, and establishes a connection between the electronic devices to construct the P2P network, thereby implementing resource sharing between the plurality of electronic devices. Since electronic devices in the P2P network are often located in the local area network, the electronic devices need to communicate with a P2P server located in the wide area network through a Network Address Translation (NAT) device. Therefore, in the process of constructing the P2P network, for any two devices, the P2P server sends addresses and ports of opposite terminals to the two electronics, and the two electronics perform NAT traversal based on the respective NAT device and the address and port of the opposite terminal, so that the two electronics located in different local area networks can communicate with each other through the respective NAT device, thereby establishing connection between the two electronics.
In the related art, one electronic device is often installed with multiple applications, and for each application, NAT traversal needs to be performed based on different ports, and connection between the electronic devices is established to construct a P2P network corresponding to each application, so that resource sharing of different applications among the multiple electronic devices is realized.
In the above technology, when any electronic device requests another electronic device for resources of different applications, multiple NAT penetrations and multiple connections are required to be established, which results in waste of network resources and long time required for establishing connections.
Disclosure of Invention
In order to solve the problem that multiple times of NAT traversal and multiple connections establishment are required when resource requests are made between electronic devices, embodiments of the present application provide a resource request method, system, apparatus, device, and computer-readable storage medium. The technical scheme is as follows:
in a first aspect, a resource request method is provided, where the method includes:
the method comprises the steps that first electronic equipment sends a first resource obtaining request to a management server, wherein the first resource obtaining request carries an identifier of a first application and an identifier of a first resource;
the management server receives the first resource acquisition request, determines second equipment information of second electronic equipment based on the identifier of the first application and the identifier of the first resource, and sends the second equipment information to the first electronic equipment, wherein the first resource of the first application is stored in the second electronic equipment;
the first electronic device receives the second device information, multiplexes the established connection between the first electronic device and the second electronic device, and requests the first resource from the second electronic device.
According to the resource request method provided by the embodiment of the application, the first electronic device sends the resource acquisition request to the management server to acquire the device information of the second electronic device stored with the requested resource, so that the established connection with the second electronic device can be multiplexed, the required resource is requested from the second electronic device, the first electronic device and the second electronic device can request the resource without establishing multiple connections, and the corresponding NAT penetration is not required to be repeatedly performed for multiple times without establishing multiple connections, so that the purposes of saving network resources and reducing the time consumption for establishing the connection are achieved.
In some embodiments, the determining second device information for the second electronic device based on the identity of the first application and the identity of the first resource comprises:
the management server queries, based on the identifier of the first application and the identifier of the first resource, a resource topology of the peer-to-peer network to obtain second device information of the second electronic device, where the resource topology is used to record a correspondence between device information of a plurality of electronic devices in the peer-to-peer network, an identifier of an application on each electronic device, and an identifier of a resource stored in each electronic device.
The second device information of the second electronic device is obtained by querying the resource topology, so that the address of the second electronic device storing the resource requested by the first electronic device is obtained, and the first electronic device can request the resource from the second electronic device.
In some embodiments, the multiplexing the established connection between the first electronic device and the second electronic device, requesting the first resource from the second electronic device comprises:
the first electronic equipment determines target connection information stored in the first electronic equipment based on first equipment information and second equipment information of the first electronic equipment, wherein the target connection information is used for indicating the established connection between the first electronic equipment and the second electronic equipment; the first electronic device requests the first resource from the second electronic device based on the target connection information.
By multiplexing the established connection between the first electronic device and the second electronic device, when the first electronic device requests resources of different applications to the second electronic device, multiple NAT penetrations and multiple connections are not required to be established, so that the aims of saving network resources and reducing time consumption for establishing the connections can be fulfilled.
In some embodiments, before the first electronic device sends the first resource acquisition request to the management server, the method further includes:
the first electronic equipment sends a second resource acquisition request to the management server, wherein the second resource acquisition request carries an identifier of a second application and an identifier of a second resource; the management server receives the second resource acquisition request, determines second device information of the second electronic device based on the identifier of the second application and the identifier of the second resource, and sends the second device information to the first electronic device, wherein the second resource of the second application is stored in the second electronic device; the first electronic device receives the second device information, establishes the connection with the second electronic device based on the first device information and the second device information, and stores the target connection information.
By storing the target connection information, the first electronic device can multiplex the connection with the second electronic device when requesting the resource from the second electronic device.
In some embodiments, the first device information includes at least one of an internet protocol version 6 IPv6 address and an internet protocol version 4 IPv4 address of the first electronic device, and the second device information includes at least one of an IPv6 address and an IPv4 address of the second electronic device;
the establishing the connection with the second electronic device based on the first device information and the second device information includes:
if the first electronic device and the second electronic device both support IPv6 communication, the first electronic device establishes the connection with the second electronic device based on the IPv6 address of the second electronic device and the IPv6 address of the first electronic device; if at least one of the first electronic device and the second electronic device does not support IPv6 communication, the first electronic device establishes the connection with the second electronic device based on the IPv4 address of the second electronic device and the IPv4 address of the first electronic device.
Through the device information, the first electronic device and the second electronic device can intelligently select to establish connection based on an IPv4 address or an IPv6 address.
In some embodiments, the first electronic device establishing the connection with the second electronic device based on the IPv4 address of the second electronic device and the IPv4 address of the first electronic device includes:
the first electronic device performs NAT traversal based on the NAT device of the first electronic device and the IPv4 address of the second electronic device, and sends a traversal message to the management server, wherein the traversal message is used for indicating the second electronic device to perform NAT traversal based on the first device information; the management server forwards the penetration message to the second electronic equipment; the second electronic device receives the penetration message, performs NAT penetration based on the NAT device of the second electronic device and the IPv4 address of the first electronic device, and sends a penetration response to the first electronic device, where the penetration response is used to indicate that NAT penetration is completed; and the first electronic equipment receives the penetration response and establishes the connection with the second electronic equipment based on the IPv4 address of the second electronic equipment and the IPv4 address of the first electronic equipment.
The management server forwards the penetration message and the penetration response to enable the first electronic equipment and the second electronic equipment to complete NAT penetration, so that connection between the two electronic equipment can be established
In some embodiments, before the first electronic device sends the first resource acquisition request to the management server, the method further includes:
the first electronic equipment sends a notification message to the management server, wherein the notification message is used for indicating that the first electronic equipment has the connection multiplexing function; the management server receives the notification message and sends a connection establishment message to the first electronic device, wherein the connection establishment message is used for indicating the establishment of connection with at least one electronic device, and the at least one electronic device enables the connection multiplexing function; the first electronic device receives the connection establishment message, establishes connection with the at least one electronic device, and the at least one electronic device comprises the second electronic device and stores connection information of the connection between the first electronic device and the at least one electronic device.
By establishing the connection in advance before the electronic equipment makes the resource request, the established connection can be directly used by the electronic equipment when the resource request is made, so that the efficiency of the resource request can be improved.
In a second aspect, there is provided a network system, the system including: the first electronic device, the second electronic device and the management server are configured to perform corresponding steps in the resource request method provided by the first aspect.
Through the network system, the first electronic equipment can send a resource acquisition request to the management server to acquire the equipment information of the second electronic equipment stored with the requested resource, so that the established connection with the second electronic equipment can be multiplexed, the required resource is requested to the second electronic equipment, the first electronic equipment and the second electronic equipment can request the resource without reestablishing the connection, and the connection can be established only by carrying out NAT penetration when the first electronic equipment and the second electronic equipment are positioned in different local area networks.
In a third aspect, a resource request apparatus is provided, where the apparatus is used in the first electronic device, and the apparatus includes a sending module and a multiplexing module.
A sending module, configured to send a first resource acquisition request to a management server, where the first resource acquisition request carries an identifier of a first application and an identifier of a first resource;
and the connection multiplexing module is used for receiving the second equipment information, multiplexing the established connection between the first electronic equipment and the second electronic equipment and requesting the first resource from the second electronic equipment.
In some embodiments, the connection multiplexing module is configured to determine target connection information stored in the first electronic device based on first device information and second device information of the first electronic device, where the target connection information is used to indicate an established connection between the first electronic device and the second electronic device; and requesting the first resource from the second electronic equipment based on the target connection information.
In some embodiments, the sending module is further configured to send a second resource obtaining request to the management server, where the second resource obtaining request carries an identifier of a second application and an identifier of a second resource;
the device also includes:
and the connection establishing module is used for receiving the second equipment information, establishing the connection with the second electronic equipment based on the first equipment information and the second equipment information, and storing the target connection information.
In some embodiments, the first device information includes at least one of an internet protocol version 6 IPv6 address and an internet protocol version 4 IPv4 address of the first electronic device, and the second device information includes at least one of an IPv6 address and an IPv4 address of the second electronic device;
the connection establishing module is configured to establish the connection with the second electronic device based on an IPv6 address of the second electronic device and an IPv6 address of the first electronic device if both the first electronic device and the second electronic device support IPv6 communication; if at least one of the first electronic device and the second electronic device does not support IPv6 communication, the first electronic device establishes the connection with the second electronic device based on the IPv4 address of the second electronic device and the IPv4 address of the first electronic device.
In some embodiments, the connection establishing module is configured to perform NAT traversal based on the NAT device of the first electronic device and the IPv4 address of the second electronic device, and send a traversal message to the management server, where the traversal message is used to instruct the second electronic device to perform NAT traversal based on the first device information; and receiving a penetration response of the second electronic equipment, wherein the penetration response is used for indicating that NAT penetration is completed, and the connection is established with the second electronic equipment based on the IPv4 address of the second electronic equipment and the IPv4 address of the first electronic equipment.
In some embodiments, the sending module is configured to send a notification message to the management server, where the notification message is used to indicate that the first electronic device has enabled the connection multiplexing function;
the connection establishing module is configured to receive the connection establishing message, establish a connection with the at least one electronic device, where the at least one electronic device includes the second electronic device, and store connection information of the connection between the first electronic device and the at least one electronic device.
Through the resource request device, the first electronic equipment acquires the equipment information of the second electronic equipment stored with the requested resources by sending a resource acquisition request to the management server, so that the established connection with the second electronic equipment can be multiplexed, the required resources are requested from the second electronic equipment, the first electronic equipment and the second electronic equipment can request the resources without establishing a plurality of connections, and the corresponding NAT penetration is not required to be repeated for a plurality of times because a plurality of connections are not required to be established, so that the purposes of saving network resources and reducing the time consumption for establishing the connection are achieved.
In a fourth aspect, a computer device is provided, which comprises a communication bus for transferring information between the above components, at least one network interface for communicating with other devices or communication networks, a memory holding program code, and at least one processor for implementing any of the steps of the resource request method of the first aspect by reading and executing the program code held in the memory.
Through the computer equipment, the first electronic equipment acquires the equipment information of the second electronic equipment stored with the requested resources by sending a resource acquisition request to the management server, so that the established connection with the second electronic equipment can be multiplexed, the required resources are requested to the second electronic equipment, the first electronic equipment and the second electronic equipment can request the resources without establishing a plurality of connections, and the corresponding NAT penetration is not required to be repeated for a plurality of times because a plurality of connections are not required to be established, so that the aims of saving network resources and reducing the time consumption for establishing the connection are fulfilled.
In a fifth aspect, a computer readable storage medium is provided, in which program code is enabled, when executed by a processor of a computer device, to perform any of the steps of the resource request method of the first aspect.
Through the computer readable storage medium, the first electronic device sends a resource acquisition request to the management server to acquire the device information of the second electronic device stored with the requested resource, so that the established connection with the second electronic device can be multiplexed, and the required resource is requested from the second electronic device, so that the first electronic device and the second electronic device can request the resource without establishing a plurality of connections, and the network resource is saved and the time consumption for establishing the connection is reduced without repeatedly performing corresponding NAT traversal.
Drawings
Fig. 1 is a schematic diagram of a network system provided in an embodiment of the present application;
fig. 2 is a schematic diagram of a network system according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram of a computer device 300 according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating steps of a method for requesting resources according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of a resource request method according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a resource topology provided by an embodiment of the present application;
fig. 7 is a schematic diagram of a resource request method according to an embodiment of the present application;
fig. 8 is a schematic diagram of a CDN network based on P2P technology according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of a resource request apparatus according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, the following detailed description of the embodiments of the present application will be made with reference to the accompanying drawings.
Before describing the technical solutions provided in the embodiments of the present application, the following description will be given of the key technical terms related to the present application.
Peer-to-peer (P2P) is a peer-to-peer network technology that relies on user group nodes to exchange information. The P2P network does not need to rely on a dedicated centralized server or workstation, and each electronic device in the network can be used as a resource requester to obtain resources from other electronic devices, and can also be used as a resource provider to send stored resources to other electronic devices. Typically, these resources include video resources, audio resources, computing resources (e.g., central processor computing resources), storage resources (e.g., cache and disk space), and the like.
A grid is a network technology for integrating or sharing various geographically distributed resources (including computer systems, storage systems, communication systems, files, databases, programs, etc.) into an organic whole to collectively perform various required tasks, and a P2P network is one type of grid.
A Content Delivery Network (CDN), which is an intelligent virtual network constructed on the basis of an existing network, depends on edge servers deployed in various regions, and enables a user to obtain required content from an adjacent edge server through functional modules of load balancing, content delivery, scheduling and the like of a central platform, thereby reducing network congestion and improving access response speed and hit rate of the user.
Network Address Translation (NAT), also called network masking and Internet Protocol (IP) masking, is a technology for rewriting a source IP address or a destination IP address when an IP packet passes through a router or a firewall in a computer network, and is commonly used in a local area network having a plurality of electronic devices but accessing the internet only through one public IP address.
NAT traversal (also called intranet traversal) is a technology for enabling electronic devices in different local area networks using NAT technology to communicate with each other, and the NAT traversal technology is the basis for implementing a P2P network.
The system architecture of the method provided by the present application is described below with reference to fig. 1.
Fig. 1 is a schematic diagram of a network system provided in an embodiment of the present application, where the network system includes a plurality of first electronic devices 101, a plurality of second electronic devices 102, and a management server 103.
The first electronic device 101 and the second electronic device 102 may be, but are not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a mainframe computer, and the like. The management server 103 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN network, a big data and artificial intelligence platform, and the like.
The first electronic device 101 and the second electronic device 102 may be located in a wide area network, and communicate with a management server 103 located in the wide area network through a wired or wireless network, the first electronic device 101 and the second electronic device 102 may also be located in a local area network, and communicate with the management server 103 located in the wide area network through a NAT device, the first electronic device 101 and the second electronic device 102 may be located in the same local area network, or may be located in local area networks of different hierarchies, and the local area network may be a network provided by an Internet Service Provider (ISP), which is not limited in this embodiment of the present application. The plurality of first electronic devices 101 can establish a connection with the plurality of second electronic devices 102, so that the plurality of first electronic devices 101, the plurality of second electronic devices 102 and the management server 103 form a P2P network, the P2P network is also referred to as a grid, and the network system is also referred to as a wormhole grid system (wormhole mesh).
In the embodiment of the present application, the first electronic device 101 and the second electronic device 102 are installed with a plurality of applications, and the plurality of applications are provided with a plurality of types of resources, including a video resource, an audio resource, a text resource, and the like. The first electronic device 101 is able to make a resource request to the second electronic device 102 based on the functionality of the P2P network. For example, as shown in fig. 2, if both the first electronic device 101 and the second electronic device 102 are installed with the application 1 and the application 2, the first electronic device 101 can request the second electronic device 102 for the resource of the application 1 and the resource of the application 2 through the connection with the second electronic device 102.
It should be understood that, the first electronic device 101 may also send the stored resource to another device based on a resource acquisition request of another electronic device, and the second electronic device 102 may also request the resource from another electronic device, which is not limited in this embodiment of the present application.
The hardware structures of the first electronic device 101, the second electronic device 102 and the management server 103 in the system architecture are described below with reference to fig. 3.
Fig. 3 is a schematic structural diagram of a computer device 300 according to an embodiment of the present application. The computer device 300 shown in fig. 3 can be configured as the first electronic device 101, the second electronic device 102, or the management server 103, and the computer device 300 is configured to perform the operations involved in the resource request method. As shown in fig. 3, the computer device 300 includes at least one processor 301, a communication bus 302, a memory 303, and at least one network interface 304.
The processor 301 is, for example, a Central Processing Unit (CPU), a Network Processor (NP), a Graphics Processing Unit (GPU), a neural-Network Processing Unit (NPU), a Data Processing Unit (DPU), a microprocessor, or one or more integrated circuits for implementing the present disclosure. For example, the processor 301 includes an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. PLDs are, for example, complex Programmable Logic Devices (CPLDs), field-programmable gate arrays (FPGAs), general Array Logic (GAL), or any combination thereof.
A communication bus 302 is used to transfer information between the above components. The communication bus 302 is optionally divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 3, but this does not mean only one bus or one type of bus.
The memory 303 is, for example, but is not limited to, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), a magnetic disc storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 303 is, for example, separate and connected to the processor 301 via a communication bus 302. Or alternatively the memory 303 and the processor 301 are integrated.
The network interface 304 uses any transceiver or the like for communicating with other devices or a communication network. The network interface 304 includes a wired network interface and optionally also a wireless network interface. The wired network interface is, for example, an ethernet interface. The ethernet interface is for example an optical interface, an electrical interface or a combination thereof. The wireless network interface is, for example, a Wireless Local Area Network (WLAN) interface, a cellular network interface, or a combination thereof.
In some embodiments, processor 301 includes one or more CPUs, such as CPU0 and CPU1 shown in FIG. 3.
In some embodiments, computer device 300 optionally includes multiple processors, such as processor 301 and processor 305 shown in FIG. 3. Each of these processors is, for example, a single-core processor, and, for example, a multi-core processor. A processor herein may alternatively refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In some embodiments, the computer device 300 also includes an output device and an input device. The output device optionally displays information in a variety of ways. For example, the output device is optionally a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display device, a Cathode Ray Tube (CRT) display device, a projector (projector), or the like. An input device is in communication with the processor 301, optionally receiving user input in a variety of ways. For example, the input device may alternatively be a mouse, a keyboard, a touch screen device, a sensing device, or the like.
Alternatively, the processor 301 implements the method in the following embodiments by reading the program code 310 saved in the memory 303, or the processor 301 implements the method in the following embodiments by an internally stored program code. In the case where the processor 301 implements the method in the embodiments described below by reading the program code 310 stored in the memory 303, the program code implementing the resource request method provided by the embodiment of the present application is stored in the memory 303.
For more details of the processor 301 to implement the above functions, reference is made to the following description of various method embodiments, which are not repeated here.
Embodiments also provide a computer readable storage medium, such as the memory 303, including program code, which is executable by the processor 301 of the computer device 300 to perform a resource request method. Alternatively, the computer-readable storage medium may be a read-only memory (ROM), a Random Access Memory (RAM), a compact-disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
Based on the system architecture of the present application, the following describes a resource request method provided by the present application with reference to fig. 4.
Fig. 4 is a flowchart of steps of a resource request method according to an embodiment of the present application, and as shown in fig. 4, the resource request method is applied to the system architecture shown in fig. 1, and the following steps 401 to 409 are described below, taking an interaction between the first electronic device 101, the second electronic device 102, and the management server 103 in the system architecture as an example.
401. The first electronic device sends a resource obtaining request M1 to the management server, wherein the resource obtaining request M1 carries the identifier of the application P1 and the identifier of the resource D1.
The application P1 is installed in the first electronic device, and the first electronic device requests the resource D1 provided by the application P1 by sending the resource request M1, for example, the first electronic device requests a video resource of a video application by sending the resource request M1, or the first electronic device requests an audio resource of a music program by sending the resource request M1, which is not limited in this embodiment of the present application. The identifier of the application P1 may be an identifier configured in a configuration file of the application P1, and may also be a virtual IP address and port number, which is not limited in this embodiment of the present application.
In some embodiments, as shown in fig. 5, the first electronic device first enables a connection multiplexing function, and then sends a resource obtaining request M1 to the management server based on the connection multiplexing function, where the connection multiplexing function is capable of providing a unified network communication function for multiple applications in any electronic device, so as to implement resource sharing of the multiple applications. Optionally, the connection multiplexing function is enabled by default when the first electronic device is powered on and started, or enabled based on a call of any application of the first electronic device, which is not limited in this embodiment of the application.
In this embodiment of the present application, the connection multiplexing function is implemented based on a Peer software development kit (Peer-SDK), where the Peer-SDK runs in a device system, for example, in the form of a plug-in, and provides a connection multiplexing function for the multiple applications, or the Peer-SDK can be installed in a first electronic device as an independent application, and provides a connection multiplexing function for the applications in the first electronic device based on a call of any application, which is called a sidecar (sidecar) mode, so that developers of the applications can directly call the Peer-SDK without modifying program codes of the applications to a large extent, and resource sharing of the multiple applications is achieved.
402. The management server receives the resource acquisition request M1, determines second device information of the second electronic device based on the identifier of the application P1 and the identifier of the resource D1, and sends the second device information to the first electronic device, wherein the resource D1 of the application P1 is stored in the second electronic device.
The second device information includes a port number of a second port of the second electronic device and a second IP address, and the second IP address includes at least one of a second internet protocol version 6 (internet protocol version 6, ipv 6) address and a second internet protocol version 4 (internet protocol version 4, ipv 4) address. The second port and the second IPv4 address are a port and an IPv4 address of a wide area network allocated by the second NAT device to the second electronic device, that is, the port and the IPv4 address of the second NAT device are used for communicating with a management server located in the wide area network, and the second NAT device is an NAT device of the second electronic device. Optionally, the second device information further includes other information of the second electronic device, such as a device identifier, a device state, a device location, and the like, which is not limited in this embodiment of the present application.
In some embodiments, the above "determining the second device information of the second electronic device based on the identifier of the application P1 and the identifier of the resource D1" includes: the management server queries a resource topology of the P2P network based on the identifier of the application P1 and the identifier of the resource D1, to obtain second device information of the second electronic device, where the resource topology is used to record a correspondence between the device information of the multiple electronic devices in the P2P network, the identifier of the application on each electronic device, and the identifier of the resource stored in each electronic device.
As shown in fig. 6, if the device information of the electronic device 1 is 10.182.100.1, the electronic device 1 stores the resource 1 of the application 1, the identifier of the application 1 is aaaa, and the identifier of the resource 1 is ZY1, the management server records the correspondence between the device information of the electronic device 1, the identifier of the application 1, and the identifier of the resource 1 (10.182.100.1.
403. The first electronic device receives the second device information, establishes connection with the second electronic device based on the first device information and the second device information, and stores target connection information used for indicating the established connection between the first electronic device and the second electronic device.
Wherein the first device information includes a port number and a first IP address of a first port of the first electronic device, and the first IP address includes at least one of a first IPv6 address and a first IPv4 address of the first electronic device. The first port and the first IPv4 address are a port and an IPv4 address of a wide area network allocated by the first NAT device to the first electronic device, that is, the port and the IPv4 address of the first NAT device, and are used to communicate with a management server located in the wide area network, where the first NAT device is a NAT device of the first electronic device. Optionally, the first device information further includes other information of the first electronic device, such as a device identifier, a device state, a device location, and the like, which is not limited in this embodiment of the application.
The target connection information includes a corresponding relationship between an address and a port used for establishing a connection between the first electronic device and the second electronic device, and optionally, the target connection information further includes other information, such as a connection state, a connection holding time, and the like, which is not limited in this embodiment of the present application.
In some embodiments, if both the first electronic device and the second electronic device support IPv6 communication, that is, both the first device information and the second device information include IPv6 addresses, the first electronic device establishes a connection with the second electronic device through a connection multiplexing function based on the first IPv6 address and the second IPv6 address, and stores the target connection information. If at least one of the first electronic device and the second electronic device does not support IPv6 communication, that is, at least one of the first device information and the second device information does not include an IPv6 address, the first electronic device establishes a connection with the second electronic device through a connection multiplexing function based on the first IPv4 address and the second IPv4 address, and stores target connection information. Optionally, the connection between the first electronic device and the second electronic device is a transmission tunnel, and the transmission tunnel can support efficient transmission of data under multiple different protocols, such as User Datagram Protocol (UDP), high speed UDP internet connection protocol (QUIC), fast reliable protocol (KCP), and the like.
In some embodiments, the first electronic device sends the target connection information to a management server, which stores the target connection information. The management server is used for recording the connection established between the electronic equipment in the P2P network by storing the connection information sent by the electronic equipment, so as to manage the P2P network.
It should be noted that, before the first electronic device establishes a connection with the second electronic device, the two electronic devices first allocate a local area network port for communication to the opposite terminal, that is, a port of the electronic device itself, notify the opposite terminal of the port number of the allocated local area network port and the local area network IPv4 address of the electronic device, and then establish a connection. Optionally, when the first electronic device and the second electronic device allocate ports, the idle ports may be allocated to the opposite terminal based on a principle of random allocation.
In some embodiments, the first electronic device and the second electronic device can respectively allocate a local area network port to an opposite terminal, and establish a connection based on an IPv6 address or an IPv4 address, and the following description separately describes the above two ways.
Illustratively, the process of allocating a lan port and establishing a connection based on an IPv6 address is described as the following 2 processes.
And 1, allocating local area network ports. The first electronic device allocates a third port to the second electronic device, the third port is a local area network port of the first electronic device, namely a port of the first electronic device itself, and is used for communicating with the second electronic device, the first electronic device sends a port number of the third port to the second electronic device through the management server, the second electronic device receives the port number of the third port and allocates a fourth port to the first electronic device, the fourth port is a local area network port of the second electronic device, namely a port of the second electronic device itself, and the second electronic device sends the port number of the fourth port to the first electronic device through the management server. It should be noted that, in the above process, the management server stores the port numbers of the local area network ports of the two electronic devices in correspondence with the corresponding device information.
And 2, establishing connection. The first electronic device sends a connection establishment request to the second IPv6 address and the fourth port based on the first IPv6 address and the third port, the second electronic device receives the connection establishment request based on the second IPv6 address and the fourth port and sends a connection establishment response to the first IPv6 address and the third port, and the first electronic device receives the connection establishment response based on the first IPv6 address and the third port and sends a confirmation message to the second IPv6 address and the fourth port to complete the establishment process of the connection. And the first electronic equipment stores the corresponding relation among the first IPv6 address, the port number of the third port, the second IPv6 address and the port number of the fourth port to obtain a target connection record.
Illustratively, the process of allocating a lan port and establishing a connection based on an IPv4 address is described as the following 2 processes.
And 1, allocating local area network ports. The first electronic equipment allocates a third port for the second electronic equipment, the port number of the third port and a third IPv4 address are sent to the second electronic equipment through the management server, the third IPv4 address is a local area network IPv4 address of the first electronic equipment, the second electronic equipment receives the port number of the third port and the third IPv4 address, a fourth port is allocated for the first electronic equipment, the port number of the fourth port and a fourth IPv4 address are sent to the first electronic equipment through the management server, and the fourth IPv4 address is a local area network IPv4 address of the second electronic equipment. It should be noted that, in the above process, the management server stores the local area network IPv4 addresses and the port numbers of the local area network ports of the two electronic devices in correspondence with the corresponding device information.
And 2, establishing connection. The first electronic device and the second electronic device can establish a connection based on the local area network IPv4 address, or establish a connection based on the wide area network IPv4 address, which will be described below.
In an implementation manner, if it is determined that the first electronic device and the second electronic device are located in the same local area network based on the third IPv4 address and the fourth IPv4 address, the first electronic device and the second electronic device establish connection based on the local area network IPv4 address, that is, the first electronic device establishes connection with the second electronic device based on the third IPv4 address, the third port, the fourth IPv4 address, and the fourth port, and stores a corresponding relationship between the third IPv4 address, the port number of the third port, the fourth IPv4 address, and the port number of the fourth port, so as to obtain target connection information. The process of establishing the connection is the same as the process of establishing the connection based on the IPv6 address, and is not described herein again.
In another implementation manner, if the first electronic device determines that the first electronic device and the second electronic device are located in different local area networks based on the third IPv4 address and the fourth IPv4 address, the first electronic device and the second electronic device perform NAT traversal respectively, and then establish connection based on the wide area network IPv4 address. The process includes that a first electronic device performs NAT traversal based on a first NAT device, a second IPv4 address and a second port, sends a traversal message to a management server, the traversal message is used for indicating the second electronic device to perform NAT traversal based on first device information, the management server forwards the traversal message to the second electronic device, the second electronic device receives the traversal message, performs NAT traversal based on the NAT device of the second electronic device and the IPv4 address of the first electronic device, sends a traversal response to the first electronic device, the traversal response is used for indicating that NAT traversal is completed, the first electronic device receives the traversal response, establishes a connection with the second electronic device based on the first IPv4 address, the first port, the second IPv4 address and the second port, and stores a correspondence between the first IPv4 address, the IPv4 address of the first port, the second IPv4 address and the port number of the second port, thereby obtaining target connection information. The process of establishing the connection is the same as the process of establishing the connection based on the IPv6 address, and is not described herein again.
The above NAT traversal process is exemplarily described. The first electronic device sends a first message to a wide area network address of the second electronic device through the first NAT device based on the local area network address of the first electronic device, that is, the first electronic device sends the first message to the second IPv4 address and the second port through the first NAT device based on the third IPv4 address and the third port, where the first message carries the third IPv4 address, the third port, the second IPv4 address and the second port, and the first NAT device receives the first message and records a first entry to complete NAT traversal, where the first entry includes a correspondence between the third IPv4 address and the third port, and between the second IPv4 address and the second port, and through the first entry, the first NAT device can forward data from the wide area network address of the second electronic device to the first electronic device. The second electronic device can complete NAT traversal by using a method similar to that of the first electronic device, so that the second NAT device records a second entry, where the second entry includes a fourth IPv4 address and a fourth port, and a correspondence between the first IPv4 address and the first port, and the second NAT device can forward data from the wide area network address of the first electronic device to the second electronic device through the second entry. After the first electronic device and the second electronic device both complete NAT traversal, the two electronic devices can communicate through the wide area network IPv4 address, and therefore connection between the two electronic devices is established.
In some embodiments, any electronic device in the P2P network can know its NAT type by communicating with the management server based on a session traversal protocol (STUN) for NAT, and can perform various types of NAT traversal including full cone NAT, restricted cone NAT, port restricted cone NAT, and symmetric NAT.
It should be noted that, if the first electronic device needs to request the second electronic device for the resource D1 by sending a plurality of resource acquisition requests, when the first electronic device sends the first resource acquisition request, the first electronic device triggers a connection establishment process with the second electronic device, and after the connection establishment is completed, the first electronic device can multiplex the connection with the second electronic device to send another resource acquisition request for the resource D1, so as to request the second electronic device for the resource D1.
It should be noted that, in steps 401 to 403, the first electronic device requests the second electronic device for a resource for the first time, and a connection establishment procedure between the first electronic device and the second electronic device is triggered. In some embodiments, the first electronic device is capable of establishing a connection with another electronic device before sending the resource obtaining request, and accordingly, before step 401, this embodiment of the present application further includes:
after the first electronic device starts the connection multiplexing function, for example, a corresponding application is started, a first notification message is sent to the management server, where the first notification message is used to indicate that the first electronic device has enabled the connection multiplexing function, the management server receives the first notification message, and sends a connection establishment message to the first electronic device, where the connection establishment message is used to indicate that a connection is established with at least one electronic device, and the at least one electronic device enables the connection multiplexing function; and the first electronic equipment receives the connection establishment message and establishes connection with the at least one electronic equipment, wherein the at least one electronic equipment comprises the second electronic equipment and stores the connection information of the connection between the first electronic equipment and the at least one electronic equipment. The process of establishing the connection between the first electronic device and the at least one electronic device is similar to that in step 403, and is not described herein again. After the first electronic device completes establishing a connection with at least one electronic device, in step 403, the first electronic device can directly request the second electronic device for the resource D1 based on the established connection with the second electronic device. For example, as shown in fig. 7, the first electronic device receives a connection establishment message from the management server, and establishes a connection with the second electronic device and a third electronic device, where both the second electronic device and the third electronic device enable a connection multiplexing function.
The connection is established in advance before the electronic equipment requests resources, so that the established connection can be directly used by the electronic equipment when the electronic equipment requests the resources, and the efficiency of the resource request can be improved.
404. The first electronic device requests the resource D1 from the second electronic device based on the connection with the second electronic device.
In some embodiments, the first electronic device sends the resource obtaining request M1 to the second electronic device based on the connection with the second electronic device, which includes the following three cases:
in an implementation manner, if the first electronic device and the second electronic device establish a connection based on an IPv6 address, the first electronic device sends a resource acquisition request M1 to the second IPv6 address and the fourth port based on the first IPv6 address and the third port. It should be noted that, in the embodiment of the present application, a format of the resource obtaining request is not limited.
In another implementation manner, if the first electronic device and the second electronic device establish a connection based on the local area network IPv4 address, the first electronic device sends a resource acquisition request M1 to the fourth IPv4 address and the fourth port based on the third IPv4 address and the third port.
In another implementation manner, if the first electronic device and the second electronic device establish a connection based on an IPv4 address of the wide area network, the first electronic device sends, through the first NAT device, a resource acquisition request M1 to the second IPv4 address and the second port based on the first IPv4 address and the first port.
In some embodiments, the management server records the resource request operation of any electronic device in the P2P network, and accordingly, this step 404 further includes: the first electronic device sends a second notification message to the management server, where the second notification message is used to notify the management server that the first electronic device requests the second electronic device to request the resource D1 of the application P1, and the management server receives the second notification message and records first resource request information, where the first resource request information is used to indicate that the first electronic device requests the second electronic device for the resource D1 of the application P1 based on a connection with the second electronic device, and the first resource request information includes target connection information, an identifier of the application P1, and an identifier of the resource D1, and optionally, the first resource request information further includes other information, such as a bandwidth and time occupied by the first electronic device for requesting the resource D1 from the second electronic device, which is not limited in this embodiment of the application. The resource request operation of the electronic equipment is recorded, so that the multiplexing situation of the connection in the P2P network and the transmission situation of the resource are managed.
405. And the second electronic equipment sends a resource acquisition response R1 to the first electronic equipment, wherein the resource acquisition response R1 carries the resource D1.
In some embodiments, the second electronic device receives the resource obtaining request M1 of the first electronic device, obtains the stored resource D1 based on the identifier of the application P1 and the identifier of the resource D1, and sends a resource obtaining response R1 carrying the resource D1 to the first electronic device.
In some embodiments, if none of the plurality of electronic devices in the P2P network stores the resource D1 requested by the first electronic device, the first electronic device can request the resource from the server of the application P1, and accordingly, as shown in fig. 7, an embodiment of the present application further includes: the management server receives the resource request M1, and if the electronic device storing the resource D1 of the application P1 cannot be inquired in the resource topology, the management server sends an address of a first application server to the first electronic device, wherein the first application server is the server of the application P1, and the first electronic device receives the address of the first application server and requests the resource D1 from the first application server.
406. The first electronic device sends a resource obtaining request M2 to the management server, wherein the resource obtaining request M2 carries the identifier of the application P2 and the identifier of the resource D2.
In some embodiments, step 406 is the same as step 401, and is not repeated herein.
407. The management server receives the resource acquisition request M2, determines second device information of the second electronic device based on the identifier of the application P2 and the identifier of the resource D2, and sends the second device information to the first electronic device, where the resource D2 of the application P2 is stored in the second electronic device.
In some embodiments, the management server determines second device information of the second electronic device based on the same method as step 402, and transmits the second device information to the first electronic device.
In some embodiments, if the management server further stores the fourth IPv4 address and the port number of the fourth port of the second device, the fourth IPv4 address, the port number of the fourth port, and the second device information are sent to the first electronic device.
408. And the first electronic equipment receives the second equipment information, multiplexes the established connection between the first electronic equipment and the second electronic equipment, and requests the second electronic equipment for the resource D2.
In some embodiments, the first electronic device receives the second device information, determines target connection information stored in the first electronic device based on the first device information and the second device information, and requests the resource D2 from the second electronic device based on the target connection information. The first electronic equipment can multiplex the connection with the second electronic equipment through the stored connection information in the first electronic equipment, and requests resources for the second electronic equipment, so that the aims of saving network resources and reducing time consumption for establishing connection are fulfilled.
In some embodiments, if, in step 407, the management server further sends the fourth IPv4 address and the port number of the fourth port to the first electronic device, step 408 includes: the first electronic device receives the second device information, the fourth IPv4 address and the port number of the fourth port, determines target connection information stored in the first electronic device based on the first device information, the second device information, the third IPv4 address and the port number of the third port, the fourth IPv4 address and the port number of the fourth port, and requests the resource D2 from the second electronic device based on the target connection information. The connection information stored in the first electronic device can be more accurately determined through the fourth IPv4 address of the second electronic device and the port number of the fourth port, so that the connection with the second electronic device is multiplexed, and a resource is requested from the second electronic device.
In some embodiments, the above process of determining the target connection information and requesting the resource D2 based on the target connection information is divided into the following 3 cases:
in an implementation manner, a first electronic device determines target connection information based on a first IPv6 address, a port number of a third port, a second IPv6 address, and a port number of a fourth port, and the first electronic device sends a resource acquisition request M2 to the second IPv6 address and the fourth port based on the first IPv6 address and the third port.
In another implementation manner, the first electronic device determines the target connection information based on the first IPv4 address, the port number of the first port, the second IPv4 address, and the port number of the second port, and sends the resource acquisition request M2 to the second IPv4 address and the second port through the first NAT device based on the first IPv4 address and the first port.
In another implementation manner, the first electronic device determines the target connection information based on the third IPv4 address, the port number of the third port, the fourth IPv4 address, and the port number of the fourth port, and the first electronic device sends the resource acquisition request M2 to the fourth IPv4 address and the fourth port based on the third IPv4 address and the third port.
By multiplexing the established connection between the first electronic device and the second electronic device, when the first electronic device requests resources of different applications to the second electronic device, multiple NAT penetrations and multiple connections are not required to be established, so that the aims of saving network resources and reducing time consumption for establishing the connections can be fulfilled.
409. And the second electronic equipment sends a resource acquisition response R2 to the first electronic equipment, wherein the resource acquisition response R2 carries the resource D2.
In some embodiments, the step 409 is similar to the step 405, and is not described herein again.
In some embodiments, if none of the plurality of electronic devices in the P2P network stores the resource D2 requested by the first electronic device, the first electronic device can request the resource from the server applying the P2, and accordingly, as shown in fig. 7, an embodiment of the present application further includes: the management server receives the resource request M2, and if the electronic device storing the resource D2 of the application P2 cannot be queried in the resource topology, the management server sends an address of a second application server to the second electronic device, where the second application server is a server of the application P2, and the first electronic device receives the address of the second application server and requests the resource D2 from the second application server.
In some embodiments, the management server may delete the information related to the offline electronic device, so as to implement dynamic capacity reduction of the P2P network, and accordingly, the embodiment of the present application further includes: the first electronic device sends a third notification message to the management server every other target time, the third notification message is used for notifying the management server that the device is online, if the management server does not receive the third notification message of the first electronic device within the target time, it is determined that the first electronic device is offline, and the management server deletes relevant data of the first electronic device, wherein the relevant data includes first device information, connection information of connections established between the first electronic device and other electronic devices, and the like.
According to the resource request method provided by the embodiment of the application, the first electronic device sends the resource acquisition request to the management server to acquire the device information of the second electronic device stored with the requested resource, so that the established connection with the second electronic device can be multiplexed, the required resource is requested from the second electronic device, the first electronic device and the second electronic device can request the resource without establishing multiple connections, and the corresponding NAT penetration is not required to be repeatedly performed for multiple times without establishing multiple connections, so that the purposes of saving network resources and reducing the time consumption for establishing the connection are achieved.
In some embodiments, the resource request method provided by the present application can be combined with a CDN network to implement a CDN network based on a P2P technology, and a network architecture of the CDN network based on the P2P technology is introduced below. As shown in fig. 8, the CDN network based on the P2P technology includes a cloud end, an edge end, an access end, a device end, and a CDN source station.
The cloud end comprises a CDN central node and a management server. The management server is used for providing related services of a P2P network, and comprises recording resource topologies of a plurality of electronic devices and a plurality of CDN edge nodes, assisting the plurality of electronic devices in NAT penetration, managing and controlling shared resources, checking the shared resources and the like.
The edge end includes a plurality of CDN edge nodes that can provide a plurality of types of resources, including file resources, video resources, audio resources, and so on.
The access end comprises a plurality of devices providing network communication services, such as a routing device, a 5G base station, a 4G base station and the like, and is used for providing the network communication services for the plurality of electronic devices of the device end, so that the plurality of electronic devices of the device end can communicate with the cloud end and the edge end.
The device side comprises a plurality of electronic devices, the electronic devices and the management server can form a P2P network, a plurality of types of resources are stored in the electronic devices, and any electronic device can request the required resources from the nearest CDN edge node and other electronic devices and can also share the resources from other electronic devices.
The CDN source station is configured to store all resources in the CDN network.
With the introduction of the network architecture of the CDN network based on the P2P technology, a process of requesting a resource by an electronic device is described below. Exemplarily, taking the first electronic device to request the resource D1 of the application P1 and the resource D2 of the application P2 as an example, assuming that the first CDN edge node is a CDN edge node storing the resource D1 and the resource D2 and closest to the first electronic device, a process of the first electronic device requesting the resource D1 and the resource D2 includes the following 2 processes.
Procedure 1, request resource D1 of application P1. The first electronic device sends a resource obtaining request M1 to a management server, the management server determines an address of a first CDN edge node based on a scheduling service, the address of the first CDN edge node is sent to the first electronic device, the management server determines second device information of a second electronic device based on a method which is the same as that in the step 402, the second device information is sent to the first electronic device, the first electronic device requests a resource D1 from the first CDN edge node, connection is established with the second electronic device based on a method which is the same as that in the steps 403 to 405, and the resource D1 is requested from the second electronic device.
Procedure 2, requesting resource D2 of application P2. The first electronic device sends a resource acquisition request M2 to a management server, the management server determines an address of a first CDN edge node based on a scheduling service, and sends the address of the first CDN edge node to the first electronic device, the management server determines second device information of a second electronic device based on a method similar to the step 406 and sends the second device information to the first electronic device, the first electronic device requests a resource D2 from the first CDN edge node, and multiplexes connection with the second electronic device based on the method similar to the steps 407 to 409 to request the resource D2 from the second electronic device.
Optionally, if the management server queries from the resource topology that a plurality of second electronic devices store the resource requested by the first electronic device, the management server sends second device information of the plurality of second electronic devices to the first electronic device, and the first electronic device can request the required resource from the plurality of second electronic devices.
In some embodiments, if there is no resource requested by the first electronic device in the CDN edge nodes of the edge end and the electronic devices of the device end, the first electronic device requests a required resource from any CDN edge node, and the CDN edge node can request the required resource from the source station through the CDN center node and return the resource to the first electronic device.
By combining the method provided by the application with the CDN network, the CDN network based on the P2P technology is realized, so that the electronic equipment can simultaneously request the needed resources from the CDN edge node and other electronic equipment, the efficiency of resource request is improved, and the connection established between the two pieces of equipment can be reused when the two pieces of electronic equipment carry out resource requests of different applications, thereby achieving the purpose of saving network resources.
Fig. 9 is a schematic structural diagram of a resource request apparatus according to an embodiment of the present application, where the resource request apparatus is used in the first electronic device to execute steps performed by the resource request method, and referring to fig. 9, the resource request apparatus includes: a sending module 901 and a connection multiplexing module 902.
A sending module 901, configured to send a first resource obtaining request to a management server, where the first resource obtaining request carries an identifier of a first application and an identifier of a first resource;
a connection multiplexing module 902, configured to receive the second device information, multiplex the established connection between the first electronic device and the second electronic device, and request the first resource from the second electronic device.
In some embodiments, the connection multiplexing module 902 is configured to determine target connection information stored in the first electronic device based on first device information and second device information of the first electronic device, where the target connection information is used to indicate an established connection between the first electronic device and the second electronic device; and requesting the first resource from the second electronic equipment based on the target connection information.
In some embodiments, the sending module 901 is further configured to send a second resource obtaining request to the management server, where the second resource obtaining request carries an identifier of a second application and an identifier of a second resource;
the device also includes:
and the connection establishing module is used for receiving the second equipment information, establishing the connection with the second electronic equipment based on the first equipment information and the second equipment information, and storing the target connection information.
In some embodiments, the first device information includes at least one of an internet protocol version 6 IPv6 address and an internet protocol version 4 IPv4 address of the first electronic device, and the second device information includes at least one of an IPv6 address and an IPv4 address of the second electronic device;
the connection establishing module is configured to establish the connection with the second electronic device based on an IPv6 address of the second electronic device and an IPv6 address of the first electronic device if both the first electronic device and the second electronic device support IPv6 communication; if at least one of the first electronic device and the second electronic device does not support IPv6 communication, the first electronic device establishes the connection with the second electronic device based on the IPv4 address of the second electronic device and the IPv4 address of the first electronic device.
In some embodiments, the connection establishing module is configured to perform NAT traversal based on the NAT device of the first electronic device and the IPv4 address of the second electronic device, and send a traversal message to the management server, where the traversal message is used to instruct the second electronic device to perform NAT traversal based on the first device information; and receiving a penetration response of the second electronic equipment, wherein the penetration response is used for indicating that NAT penetration is completed, and the connection is established with the second electronic equipment based on the IPv4 address of the second electronic equipment and the IPv4 address of the first electronic equipment.
In some embodiments, the sending module 901 is configured to send a notification message to the management server, where the notification message is used to indicate that the first electronic device has enabled the connection multiplexing function;
the connection establishing module is configured to receive the connection establishing message, establish a connection with the at least one electronic device, where the at least one electronic device includes the second electronic device, and store connection information of the connection between the first electronic device and the at least one electronic device.
It should be noted that: in the resource request device provided in the foregoing embodiment, only the division of the functional modules is illustrated when a resource request is made, and in practical applications, the function allocation may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the resource request apparatus and the resource request method provided in the foregoing embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments and are not described herein again.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (16)

1. A method for resource request, the method comprising:
the method comprises the steps that first electronic equipment sends a first resource obtaining request to a management server, wherein the first resource obtaining request carries an identifier of a first application and an identifier of a first resource;
the management server receives the first resource obtaining request, determines second equipment information of second electronic equipment based on the identifier of the first application and the identifier of the first resource, and sends the second equipment information to the first electronic equipment, wherein the first resource of the first application is stored in the second electronic equipment;
and the first electronic equipment receives the second equipment information, multiplexes the established connection between the first electronic equipment and the second electronic equipment, and requests the first resource from the second electronic equipment.
2. The method of claim 1, wherein determining second device information for a second electronic device based on the identity of the first application and the identity of the first resource comprises:
the management server queries, based on the identifier of the first application and the identifier of the first resource, a resource topology of a peer-to-peer network to obtain second device information of the second electronic device, where the resource topology is used to record a correspondence between device information of multiple electronic devices in the peer-to-peer network, the identifier of an application on each electronic device, and the identifier of a resource stored in each electronic device.
3. The method of claim 1, wherein the multiplexing the established connection between the first electronic device and the second electronic device, and wherein requesting the first resource from the second electronic device comprises:
the first electronic device determines target connection information stored in the first electronic device based on first device information and second device information of the first electronic device, wherein the target connection information is used for indicating an established connection between the first electronic device and the second electronic device;
the first electronic device requests the first resource from the second electronic device based on the target connection information.
4. The method of claim 3, wherein before the first electronic device sends the first resource acquisition request to the management server, the method further comprises:
the first electronic equipment sends a second resource obtaining request to the management server, wherein the second resource obtaining request carries an identifier of a second application and an identifier of a second resource;
the management server receives the second resource obtaining request, determines second device information of the second electronic device based on the identifier of the second application and the identifier of the second resource, and sends the second device information to the first electronic device, wherein the second resource of the second application is stored in the second electronic device;
and the first electronic equipment receives the second equipment information, establishes the connection with the second electronic equipment based on the first equipment information and the second equipment information, and stores the target connection information.
5. The method of claim 4, wherein the first device information includes at least one of an internet protocol version 6 IPv6 address and an internet protocol version 4 IPv4 address of the first electronic device, and wherein the second device information includes at least one of an IPv6 address and an IPv4 address of the second electronic device;
the establishing the connection with the second electronic device based on the first device information and the second device information includes:
if the first electronic device and the second electronic device both support IPv6 communication, the first electronic device establishes the connection with the second electronic device based on the IPv6 address of the second electronic device and the IPv6 address of the first electronic device;
if at least one of the first electronic device and the second electronic device does not support IPv6 communication, the first electronic device establishes the connection with the second electronic device based on the IPv4 address of the second electronic device and the IPv4 address of the first electronic device.
6. The method of claim 5, wherein establishing, by the first electronic device, the connection with the second electronic device based on the IPv4 address of the second electronic device and the IPv4 address of the first electronic device comprises:
the first electronic device performs NAT traversal based on the NAT device of the first electronic device and the IPv4 address of the second electronic device, and sends a traversal message to the management server, wherein the traversal message is used for indicating the second electronic device to perform NAT traversal based on the first device information;
the management server forwards the penetration message to the second electronic equipment;
the second electronic device receives the penetration message, performs NAT penetration based on the NAT device of the second electronic device and the IPv4 address of the first electronic device, and sends a penetration response to the first electronic device, wherein the penetration response is used for indicating that NAT penetration is completed;
and the first electronic equipment receives the penetration response and establishes the connection with the second electronic equipment based on the IPv4 address of the second electronic equipment and the IPv4 address of the first electronic equipment.
7. The method of claim 3, wherein before the first electronic device sends the first resource acquisition request to the management server, the method further comprises:
the first electronic device sends a notification message to the management server, wherein the notification message is used for indicating that the first electronic device has enabled a connection multiplexing function;
the management server receives the notification message and sends a connection establishment message to the first electronic device, wherein the connection establishment message is used for indicating that connection is established with at least one electronic device, and the at least one electronic device enables the connection multiplexing function;
and the first electronic equipment receives the connection establishment message and establishes connection with the at least one piece of electronic equipment, wherein the at least one piece of electronic equipment comprises the second electronic equipment and stores the connection information of the connection between the first electronic equipment and the at least one piece of electronic equipment.
8. A network system, characterized in that the system comprises a first electronic device, a second electronic device and a management server,
the first electronic device is configured to send a first resource acquisition request to a management server, where the first resource acquisition request carries an identifier of a first application and an identifier of a first resource;
the management server is configured to receive the first resource acquisition request, determine second device information of a second electronic device based on the identifier of the first application and the identifier of the first resource, and send the second device information to the first electronic device, where the first resource of the first application is stored in the second electronic device;
the first electronic device is configured to receive the second device information, multiplex the established connection between the first electronic device and the second electronic device, and request the first resource from the second electronic device.
9. The system of claim 8,
the management server is configured to query, based on the identifier of the first application and the identifier of the first resource, a resource topology of a peer-to-peer network to obtain second device information of the second electronic device, where the resource topology is used to record a correspondence between device information of a plurality of electronic devices in the peer-to-peer network, an identifier of an application on each electronic device, and an identifier of a resource stored in each electronic device.
10. The system of claim 8,
the first electronic device is configured to determine target connection information stored in the first electronic device based on first device information and second device information of the first electronic device, where the target connection information is used to indicate an established connection between the first electronic device and the second electronic device;
the first electronic device is configured to request the first resource from the second electronic device based on the target connection information.
11. The system of claim 10,
the first electronic device is configured to send a second resource acquisition request to the management server, where the second resource acquisition request carries an identifier of a second application and an identifier of a second resource;
the management server is configured to receive the second resource acquisition request, determine second device information of the second electronic device based on the identifier of the second application and the identifier of the second resource, and send the second device information to the first electronic device, where the second resource of the second application is stored in the second electronic device;
the first electronic device is configured to receive the second device information, establish the connection with the second electronic device based on the first device information and the second device information, and store the target connection information.
12. The system of claim 11, wherein the first device information includes at least one of an internet protocol version 6 IPv6 address and an internet protocol version 4 IPv4 address of the first electronic device, and wherein the second device information includes at least one of an IPv6 address and an IPv4 address of the second electronic device;
the first electronic device is configured to establish the connection with the second electronic device based on an IPv6 address of the second electronic device and an IPv6 address of the first electronic device if both the first electronic device and the second electronic device support IPv6 communication;
the first electronic device is configured to establish the connection with the second electronic device based on an IPv4 address of the second electronic device and an IPv4 address of the first electronic device if at least one of the first electronic device and the second electronic device does not support IPv6 communication.
13. The system of claim 12,
the first electronic device is configured to perform NAT traversal based on the NAT device of the first electronic device and the IPv4 address of the second electronic device, and send a traversal message to the management server, where the traversal message is used to instruct the second electronic device to perform NAT traversal based on the first device information;
the management server is used for forwarding the penetration message to the second electronic equipment;
the second electronic device is configured to receive the tunneling message, perform NAT tunneling based on a NAT device of the second electronic device and an IPv4 address of the first electronic device, and send a tunneling response to the first electronic device, where the tunneling response is used to indicate that NAT tunneling is completed;
the first electronic device is used for receiving the penetration response and establishing the connection with the second electronic device based on the IPv4 address of the second electronic device and the IPv4 address of the first electronic device.
14. The system of claim 10,
the first electronic device is used for sending a notification message to the management server, wherein the notification message is used for indicating that the first electronic device has enabled a connection multiplexing function;
the management server is configured to receive the notification message and send a connection establishment message to the first electronic device, where the connection establishment message is used to indicate establishment of a connection with at least one electronic device, and the at least one electronic device enables the connection multiplexing function;
the first electronic device is configured to receive the connection establishment message and establish a connection with the at least one electronic device, where the at least one electronic device includes the second electronic device and stores connection information of the connection between the first electronic device and the at least one electronic device.
15. A computer device comprising a communication bus for transferring information between the above components, at least one network interface for communicating with other devices or communication networks, a memory holding program code, and at least one processor for implementing the resource request method according to any one of claims 1 to 7 by reading and executing the program code held in the memory.
16. A computer-readable storage medium, wherein program code in the computer-readable storage medium, when executed by a processor of a computer device, enables the computer device to perform the resource request method of any of claims 1-7.
CN202111045623.7A 2021-09-07 2021-09-07 Resource request method, system, device, equipment and storage medium Pending CN115776493A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111045623.7A CN115776493A (en) 2021-09-07 2021-09-07 Resource request method, system, device, equipment and storage medium
PCT/CN2022/093659 WO2023035660A1 (en) 2021-09-07 2022-05-18 Resource request method, system and apparatus, and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111045623.7A CN115776493A (en) 2021-09-07 2021-09-07 Resource request method, system, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115776493A true CN115776493A (en) 2023-03-10

Family

ID=85387804

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111045623.7A Pending CN115776493A (en) 2021-09-07 2021-09-07 Resource request method, system, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN115776493A (en)
WO (1) WO2023035660A1 (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102291808B (en) * 2011-06-03 2013-12-04 莫雅静 Network communication method, communication equipment and middleware of communication equipment
CN105376299B (en) * 2015-09-30 2020-12-04 深圳市先河系统技术有限公司 Network communication method, equipment and network attached storage equipment
CN107205026A (en) * 2017-05-22 2017-09-26 厦门市美亚柏科信息股份有限公司 A kind of Point-to-Point Data Transmission method and system
CN112055037A (en) * 2019-06-06 2020-12-08 深圳市尚云互联技术有限公司 NAT (network Address translation) penetration connection method and system

Also Published As

Publication number Publication date
WO2023035660A1 (en) 2023-03-16

Similar Documents

Publication Publication Date Title
CN108650182B (en) Network communication method, system, device, equipment and storage medium
EP2112788A1 (en) A method, system and nodes for p2p content sharing
US11856065B2 (en) Data transmission for service integration between a virtual private cloud and an intranet
CN113572831B (en) Communication method, computer equipment and medium between Kubernetes clusters
CN112040030B (en) Message transmission method and device, computer equipment and storage medium
CN112822115B (en) Service framework construction method and system based on plug-in engine
CN112333017B (en) Service configuration method, device, equipment and storage medium
CN113364741A (en) Application access method and proxy server
CN115379010B (en) Container network construction method, device, equipment and storage medium
CN111726400A (en) Reverse connection method, device and server-side system
EP3937502A1 (en) Method, apparatus and device for pushing video stream, and storage medium
CN112491984A (en) Container editing engine cluster management system based on virtual network bridge
CN110012107B (en) Data communication method, equipment, device, system and storage medium
CN110636149B (en) Remote access method, device, router and storage medium
CN115242882B (en) Method and device for accessing k8s container environment based on transport layer route
CN115333993B (en) Method, equipment and storage medium for customizing container group routing in container environment
CN116389599A (en) Gateway service request processing method and device and cloud native gateway system management method and device
CN115776493A (en) Resource request method, system, device, equipment and storage medium
WO2020031157A1 (en) Method and apparatus for network function selection scheme in service based architecture of communication network
US20220019485A1 (en) Preserving eventually consistent distributed state of multi-layer applications
KR20110070447A (en) Method of distributed discovery of communication participant in data distribution service
WO2021087865A1 (en) Addressing method, addressing system and addressing apparatus
CN111315037B (en) Communication link establishing method and device, computer equipment and storage medium
JP2004264911A (en) Computer node, cluster system, cluster control method, and cluster control program
CN114124890A (en) Determination method, virtual router, control equipment and domain name resolution system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication