WO2017113816A1 - 一种对等网络连接方法及装置 - Google Patents

一种对等网络连接方法及装置 Download PDF

Info

Publication number
WO2017113816A1
WO2017113816A1 PCT/CN2016/096010 CN2016096010W WO2017113816A1 WO 2017113816 A1 WO2017113816 A1 WO 2017113816A1 CN 2016096010 W CN2016096010 W CN 2016096010W WO 2017113816 A1 WO2017113816 A1 WO 2017113816A1
Authority
WO
WIPO (PCT)
Prior art keywords
server
peer
port
router
network connection
Prior art date
Application number
PCT/CN2016/096010
Other languages
English (en)
French (fr)
Inventor
徐晓光
Original Assignee
乐视控股(北京)有限公司
乐视云计算有限公司
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 乐视控股(北京)有限公司, 乐视云计算有限公司 filed Critical 乐视控股(北京)有限公司
Publication of WO2017113816A1 publication Critical patent/WO2017113816A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • 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
    • 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

Definitions

  • the present application relates to the field of network communication technologies, and in particular, to a peer-to-peer network connection method and apparatus.
  • the traditional solution has been improved for resource servers.
  • the resource server provides data to the user, and even if the cost is upgraded, the resource server cannot be upgraded to meet the increasing user demand.
  • another solution in the prior art adopts a P2P peer-to-peer network connection mode, and the requesting end and the server establish a peer-to-peer connection to share resources, so that the requesting end does not need to continue to the resource.
  • the server requests the data, which shares part of the pressure on the resource server.
  • the P2P network system usually adopts the Webrtc connection protocol for peer-to-peer connection. This connection protocol has a connection interruption or a connection failure due to network stability, router support limitations, etc., and shares the pressure of the resource server. The effect is not ideal.
  • the embodiment of the present invention provides a peer-to-peer network connection method and device, which are used to solve the problem that the probability of connection interruption or connection failure of the requester and the server is high in the P2P network system in the prior art.
  • an embodiment of the present application provides a peer-to-peer network connection method, including:
  • the requesting end obtains, by the P2P server, port information of the server that includes the resource required by the requesting end, where the port information includes a public network port of the router mapped by the private port of the server;
  • the requesting end sends a peer-to-peer network connection request to the public network port of the router, and the router connects the peer-to-peer network according to the private port of the server that is mapped by the public network port of the router. Request forwarding to the server;
  • the requesting end After receiving the response message that the server forwarded by the router responds to the peer network connection request, the requesting end establishes a peer-to-peer network connection with the server.
  • the embodiment of the present application provides a peer-to-peer network connection method, including:
  • the server generates port information according to the public network port of the router mapped by its private port.
  • the server reports the resource information and the port information to the P2P server.
  • the server Receiving, by the server, a response message of the peer-to-peer network connection request, by using a public network port of the router mapped by the private port of the server, the server forwards the response message to the peer-to-peer network connection request to the a requesting end and establishing a peer-to-peer network connection with the requesting end;
  • the router After the peer-to-peer network connection request is obtained by the requesting end, after obtaining the port information of the server that is required by the P2P server and including the resource required by the requesting end, the router is configured according to the private port of the server included in the port information.
  • the public network port is sent to the public network port of the router, and is forwarded by the router to the server according to the private port of the server mapped by the public network port of the router.
  • the embodiment of the present application provides a peer-to-peer network connection method, including:
  • the router receives the peer-to-peer network connection request sent by the requesting end, and the peer-to-peer network connection request is obtained by the requesting end after acquiring the port information of the server that is required by the P2P server and includes the resource required by the requesting end, according to the port information.
  • the public network port of the router that is mapped by the private port of the server is sent to the public network port of the router;
  • the router forwards the peer-to-peer network connection request to the server according to the private port of the server mapped by the public network port of the router;
  • the embodiment of the present application provides a peer-to-peer network connection device, including:
  • the information obtaining module is configured to obtain, by the P2P server, port information of a server that includes the resource required by the requesting end, where the port information includes a public network port of a router mapped by a private port of the server;
  • connection requesting module configured to send a peer network connection request to a public network port of the router, where Transmitting, by the router, the peer-to-peer network connection request to the server according to the private port of the server that is mapped by the public network port of the router;
  • a connection establishing module configured to establish a peer-to-peer network connection with the server after receiving the response message that the server forwarded by the router responds to the peer-to-peer network connection request.
  • the embodiment of the present application provides a peer-to-peer network connection device, including:
  • An information generating module configured to generate port information according to a public network port of a router mapped by its private port
  • An information reporting module configured to report resource information and port information to a P2P server
  • a response module configured to: when receiving the peer-to-peer network connection request sent by the requesting end, forward a response message responsive to the peer-to-peer network connection request to a public network port of the router mapped by the private port of the server to the public network port Determining the requesting end and establishing a peer-to-peer network connection with the requesting end;
  • the router After the peer-to-peer network connection request is obtained by the requesting end, after obtaining the port information of the server that is required by the P2P server and including the resource required by the requesting end, the router is configured according to the private port of the server included in the port information.
  • the public network port is sent to the public network port of the router, and is forwarded by the router to the server according to the private port of the server mapped by the public network port of the router.
  • the embodiment of the present application provides a peer-to-peer network connection device, including:
  • a request receiving module configured to receive a peer-to-peer network connection request sent by the requesting end, where the peer-to-peer network connection request is obtained by the requesting end after acquiring the port information of the server that is required by the P2P server and includes the resource required by the requesting end, Transmitting to the public network port of the router according to the public network port of the router mapped by the private port of the server included in the port information;
  • a forwarding module configured to forward the peer-to-peer network connection request to the server according to a private port of the server that is mapped by a public network port of the router;
  • the forwarding module is further configured to receive a response message sent by the server in response to the peer network connection request sent by the requesting end, and forward the response message to the requesting end, so as to facilitate the requesting end After receiving the response message of the server forwarded by the router, establishing a peer-to-peer network connection with the server.
  • the embodiment of the present application provides a non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium can store computer instructions, which can implement the first aspect of the present application when executed Some or all of the various implementations of the peer-to-peer network connection method provided by the embodiments.
  • An embodiment of the present application provides an electronic device, including: one or more processors; and a memory; wherein the memory stores instructions executable by the one or more processors, the instructions being set to A peer-to-peer network connection method for performing any of the embodiments of the first aspect of the present application.
  • An embodiment of the present application provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, The computer is caused to perform any peer-to-peer network connection method of the first aspect of the present application.
  • the embodiment of the present application provides a non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium can store computer instructions, which can implement the pair provided by the second aspect of the present application.
  • An embodiment of the present application provides an electronic device, including: one or more processors; and a memory; wherein the memory stores instructions executable by the one or more processors, the instructions being set to A peer-to-peer network connection method for performing the second embodiment of the present application.
  • An embodiment of the present application provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, The computer is caused to perform a peer-to-peer network connection method of any of the embodiments of the second aspect of the present application.
  • the embodiment of the present application provides a non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium can store a computer instruction, and when the computer instruction is executed, the pair provided by the embodiment of the third aspect of the present application can be implemented.
  • An embodiment of the present application provides an electronic device, including: one or more processors; and a memory; wherein the memory stores instructions executable by the one or more processors, the instructions being set to A peer-to-peer network connection method for performing any of the embodiments of the third aspect of the present application.
  • An embodiment of the present application provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, The computer is caused to perform a peer-to-peer network connection method of any of the embodiments of the third aspect of the present application.
  • the peer-to-peer network connection method and device provided by the embodiment of the present application, by requesting the connection of the requesting end
  • the public network port of the router is forwarded to the private port of the server, which solves the problem that the requester cannot establish a peer-to-peer network connection with the server in the private network due to the limitation of the router in the prior art.
  • a supplementary connection mode is provided for the existing P2P network system, so as to avoid the problem that the connection failure rate or the connection interruption rate is too high due to the limitation of the existing connection mode, thereby improving the ability of the P2P network system to share the pressure of the resource server.
  • FIG. 1 is a flowchart of a peer-to-peer network connection method according to an embodiment of the present application
  • FIG. 2 is a flowchart of an embodiment of a peer-to-peer network connection method according to an embodiment of the present application
  • FIG. 3 is a flowchart of a peer-to-peer network connection method according to an embodiment of the present application
  • FIG. 4 is a flowchart of a peer-to-peer network connection method according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a peer-to-peer network connection apparatus according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of an embodiment of a peer-to-peer network connection apparatus according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a peer-to-peer network connection apparatus according to an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a peer-to-peer network connection apparatus according to an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram of another electronic device according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of still another electronic device according to an embodiment of the present application.
  • the peer-to-peer network connection method and device provided by the embodiments of the present application can be applied to a webcast/on-demand scenario.
  • the Webrtc protocol is generally used to establish a peer-to-peer network connection with the server, and the requesting end initiates a connection request with the server to the P2P server.
  • the P2P server returns the port address corresponding to the server to the requesting end, and then the requesting end establishes a connection with the server according to the port address of the server.
  • the WERTC protocol only applies to the case where the port address of the server is a public network port.
  • the requester and the server can only establish a connection by direct addressing. Therefore, when the server is in the private network, the requesting end cannot establish a connection with the server through the Webrtc protocol, and the live/on-demand resources cannot be shared between the requesting end and the server. In this case, the requesting end can only Requesting data from the resource server, the server cannot play the role of sharing the resource server pressure.
  • the peer-to-peer network connection method and apparatus provided by the embodiments of the present application are to change the above-mentioned defects of the Webrtc protocol, and provide a supplementary connection scheme.
  • the requesting end forwards the connection request to the private port of the server through the public network port of the router. Therefore, the peer end connection between the requesting end and the server can be implemented in the scenario where the server is in the private network.
  • peer-to-peer network connection method and device provided by the embodiments of the present application are also applicable to other scenarios that need to establish a network connection with a terminal in a private network, which is not limited in this embodiment of the present application.
  • an embodiment of the present application provides a peer-to-peer network connection method, including:
  • the requesting end obtains, by the P2P server, the port information of the server that includes the resource required by the requesting end, where the port information includes a public network port of the router mapped by the private port of the server;
  • the requesting end sends a peer-to-peer network connection request to a public network port of the router, where the router forwards the peer-to-peer network connection request according to the private port of the server that is mapped by the public network port of the router.
  • the server To the server;
  • the requesting end After receiving the response message that the server forwarded by the router responds to the peer-to-peer network connection request, the requesting end establishes a peer-to-peer network connection with the server.
  • the resource request information reported by the requesting end is received and stored in the P2P server in the step S101.
  • the resource request information includes the name, the content, the length, and the like of the required resource, and the viewing information reported by the requesting end and the server is also stored. For example, the name of the live/on-demand program viewed by the requesting end, the total length, the current playing frame, and the like.
  • the requesting end When the requesting end is a terminal, the requesting end also reports its port information to the terminal. Said P2P server.
  • the P2P server also receives and stores the port information reported by the server, where the port information includes the public network port of the router mapped by the private port of the server, and the requesting end obtains the router corresponding to the server from the P2P server.
  • the public network port sends a peer network connection request to the public network port of the router in S102.
  • the requesting end and the server end exchange information through the P2P server, that is, the requesting end obtains the resource information and the port information of the server, and the server can also obtain the resource request information, the viewing information, the port information, and the like of the requesting end.
  • the requesting end and the server may report the resource request information to the P2P server by using any one of UTP, HTTP, and Websocket protocols.
  • step S102 the requesting end sends the peer-to-peer network connection request to the public network port of the router corresponding to the server.
  • the router After receiving the peer-to-peer network connection request from the requesting end, the router automatically refers to the private port of the server and the public network port of the router.
  • the mapping relationship forwards the peer network connection request to the server. For example, when the server is located in the company's LAN, the private port of the server refers to the intranet port of the server, and the public port refers to the external port of the company router.
  • the server when the server receives the peer-to-peer network connection request sent by the requesting end, it responds according to the actual situation. If the server agrees to establish a connection, it will feed back a response message to the requesting end, and the server responds to the peer-to-peer network. The feedback path of the requested response message is forwarded to the requesting end through the public network port of the corresponding router. After receiving the response message, the requesting end successfully establishes a peer-to-peer network connection with the server.
  • a supplementary connection mode is provided, and the peer-to-peer network connection request of the requesting end is forwarded to the private port of the server through the public network port of the router, thereby establishing the requesting end and the service. Peer-to-peer network connection.
  • the requesting end and the server end may be terminal devices such as a mobile phone, a computer, a cloud video terminal, and a television, and the requesting end may also be an HTML5 webpage end, for example, the user passes the HTML5 webpage. Online video on demand. Since the HTML5 webpage runs in the browser, it does not have access to local information, and when it is in the private network, it cannot perform port mapping with the router, and thus cannot provide port information for receiving peer network connection request.
  • the peer-to-peer network connection request can only be initiated to other terminals in the P2P network system, and the peer-to-peer network connection request sent by other terminals cannot be accepted.
  • the peer-to-peer network connection method provided by the embodiment of the present application is also applicable to other types of requesters to establish a peer-to-peer network connection of each terminal in the private network in the P2P network system.
  • the method further includes:
  • the requesting end receives the resource sent by the server forwarded by the router according to the public network port of the router mapped by the private port of the server included in the port information.
  • the resource can be shared between the requesting end and the server.
  • the requesting end receives the resource sent by the server, the requesting end passes the public network port of the router corresponding to the server. Receiving, by the router, the resource sent by the server.
  • the Websocket protocol is enabled on the private port of the server, the requesting end uses the Websocket protocol to communicate with the server.
  • the requesting end and the server can perform two-way communication, that is, The requesting end may receive the resource in the server that is forwarded by the router corresponding to the server, and the requesting end may forward the resource to the server through the public network port of the router corresponding to the server.
  • the establishment of the peer-to-peer network connection has active and passive points, and after the connection is successfully established, the requesting end and the server end can realize two-way communication, no longer active and passive. This is different from the existing HTTP protocol and other one-way communication protocols, making resource sharing between terminals in the P2P network system more flexible and convenient.
  • the requesting end may first download a buffer resource of a predetermined length from the node server of the CDN before performing the peer-to-peer network connection; and downloading the buffer resource is completed. Afterwards, the resource after the buffer resource is configured as a request resource into the resource request information.
  • the requesting end first requests a part of the buffering resource from the node server in the CDN architecture. For example, when the requesting end views a movie, the requesting end can first download the buffered data for 10s in the node server. With the buffering time of 10s, the requesting end can pass the P2P in the buffering time. The way continues to look for resources, that is, resources after buffering resources.
  • the resource request information may be used to segment the resources required by the requesting end, and may respectively initiate a peer-to-peer network connection request to different server terminals according to the resource information of each server obtained from the P2P server, and obtain resources in a distributed manner. Improve the speed of resource acquisition.
  • an embodiment of the present application further provides a peer-to-peer network connection method, including:
  • the server generates port information according to a public network port of the router mapped by the private port.
  • the server reports the resource information and the port information to the P2P server.
  • the server When receiving the peer-to-peer network connection request sent by the requesting end, the server sends a response message that responds to the peer-to-peer network connection request to the router that is mapped by the private port of the server.
  • the public network port is forwarded to the requesting end, and establishes a peer-to-peer network connection with the requesting end;
  • the router After the peer-to-peer network connection request is obtained by the requesting end, after obtaining the port information of the server that is required by the P2P server and including the resource required by the requesting end, the router is configured according to the private port of the server included in the port information.
  • the public network port is sent to the public network port of the router, and is forwarded by the router to the server according to the private port of the server mapped by the public network port of the router.
  • the server when the server is in the private network, the server configures the public network port of the router whose private port is mapped to the port information. For example, when the server is in the company LAN, the server maps its port 5000. Information such as the address to the router's port 8000, the router's port 8000, etc. will be configured to the port information.
  • the port information and the resource information of the server are reported to the P2P server through any one of the UTP, HTTP, and Websocket protocols, and the requesting end obtains the port information and the resource information of the server from the P2P server, and according to the The resource information of the server determines whether to send a peer network connection request to the server.
  • the requesting end knows the public network port of the router corresponding to the server according to the port information of the server.
  • the peer-to-peer network connection request will be sent to the public network port of the router corresponding to the server, and the router will automatically forward the peer-to-peer network connection request of the requesting end to the server.
  • the server forwards the response message to the requesting end through the public network port of the router, and after receiving the response message from the server, the requesting end receives the response message from the server.
  • the requesting end and the server can successfully establish a peer-to-peer network connection and can start bidirectional transmission of resources.
  • mapping relationship between the private port of the server and the public network port of the router can be established in various manners.
  • S201 is further illustrated by an embodiment.
  • S201 includes: the server generates port information according to the public network port allocated by the router to the private port of the server.
  • the router can automatically assign a public network port to each terminal in the private network according to the idle state of each public network port, and feed back the mapping relationship between the public network port and the private port of the terminal to the terminal.
  • the server is based on the server.
  • the mapping between the private port of the router and the public network port of the router is obtained, and the port information of the public network port of the router mapped by the private port is generated.
  • the UPNP protocol can be used for network address translation, the network address of the private port of the server is mapped to the public network port of the router, and the network address of the public network port of the router is configured into the port information.
  • the server in the private network may also request the router to provide a public network port through the UPNP protocol to perform mapping of the private port of the server.
  • the peer-to-peer network connection request is sent to the public network port of the router according to the network address of the public network port of the router in the port information of the server, and the public network port
  • the peer-to-peer network connection request is forwarded to the server, so that the server receives the peer-to-peer network connection request of the requesting end.
  • the embodiment of the present application provides a technical solution that the server receives the peer-to-peer network connection request of the requesting end and successfully feeds back the response message to the requesting end to establish a peer-to-peer network connection with the requesting end.
  • an embodiment of the present application provides a peer-to-peer network connection method, including:
  • the router receives a peer-to-peer network connection request sent by the requesting end, where the peer-to-peer network connection request is obtained by the requesting end after acquiring the port information of the server that is required by the P2P server and includes the resource required by the requesting end.
  • the port information includes a public network port of the router mapped by the private port of the server, and is sent to the public network port of the router;
  • the router forwards the peer-to-peer network connection request to the server according to the private port of the server that is mapped by the public network port of the router.
  • the router receives a response message sent by the server in response to the peer network connection request sent by the requesting end, and forwards the response message to the requesting end, so that the requesting end receives the message. After the router forwards the response message of the server, establish a peer-to-peer network connection with the server.
  • the router receives the peer-to-peer network connection request sent by the requesting end, and forwards the received peer-to-peer network connection request to the server.
  • the requesting end first obtains the public network port of the router corresponding to the server according to the port information of the server that is provided by the P2P server, and then sends the peer network connection request to the router according to the obtained port information.
  • the router forwards the peer network connection request to the server according to the mapping between the public port of the router and the private port of the server.
  • the server After receiving the peer-to-peer network connection request, the server sends a response message in response to the peer-to-peer network connection request, and the response message sent by the server is sent to the public network port of the router, and the router automatically The response message sent by the server is forwarded to the requesting end.
  • the requesting end and the server successfully establish a peer-to-peer network connection, and can perform bidirectional resource sharing, and the requesting end and the server end perform resource sharing process. In the middle, the router can still assume the forwarding function to ensure smooth communication between the requesting end and the server.
  • the user requests to watch a movie through the player in the HTML5 webpage.
  • the player After selecting the played movie in the player, the player first requests the node server in the CDN architecture to download the buffer resource of 10s. After the download is completed, the player starts playing. Buffer resources, the player will acquire the resources of the movie through a peer-to-peer network connection within a buffer time of 10s, in the P2P network system, the player in the webpage (requesting end) and the player of each terminal (service)
  • the viewing information is reported to the P2P server, and the viewing information includes the resource, port, viewing progress, and the like of the requesting end or the server, and the viewing information provides a matching basis for the requesting end and the server.
  • the requesting end learns that the server A, B, and C contain the resources of the movie, and the requesting end initiates a peer-to-peer network connection request based on the Webrte and the Websocket protocol to the server A, B, and C respectively, and the server A and C are at In the public network, the requesting end can successfully establish a peer-to-peer network connection based on the Webrtc protocol with the server A and C; the server B is in the private network, the connection request initiated by the requesting end based on the Webrtc protocol fails, and the requesting end parses the P2P server.
  • the port information of the server B is forwarded, and the connection request based on the Websocket protocol is forwarded to the server B through the public network port of the router corresponding to the server B, and after receiving the peer network connection request sent by the requesting end, the server B receives the request for the peer network connection sent by the requesting end.
  • the response message is fed back to the requesting end through the public network port of the router.
  • the requesting end and the server B successfully establish a peer-to-peer network connection based on the Websocket protocol. For the requesting end, it uses two protocols to initiate a request connection to each server.
  • connection request failure or interruption another connection request can be used as a supplementary connection, thereby improving the P2P mode for resource acquisition.
  • the success rate increases the proportion of the resources acquired by the P2P method in the total amount of resources required at the web page, thereby reducing the service pressure of the CDN architecture.
  • the two connection requests based on the Webrtc and Websocket protocols are independent of each other. Complement each other, providing a more optimized connection scheme for the P2P mode.
  • the non-transitory computer readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (Random Access). Memory, RAM), etc.
  • an embodiment of the present application provides a peer-to-peer network connection device, which is configured in a requesting end of a P2P network system, and includes:
  • the information obtaining module 11 is configured to obtain, by the P2P server, port information of a server that includes the resource required by the requesting end, where the port information includes a public network port of a router mapped by a private port of the server;
  • the connection requesting module 12 is configured to send a peer-to-peer network connection request to the public network port of the router, where the router sends the peer-to-peer network connection request according to the private port of the server that is mapped by the public network port of the router. Forwarded to the server;
  • the connection establishing module 13 is configured to establish a peer-to-peer network connection with the server after receiving the response message that the server forwarded by the router responds to the peer-to-peer network connection request.
  • the resource request information reported by the peer-to-peer network connection device in the embodiment is received and stored in the P2P server.
  • the resource request information includes the name, content, and length of the required resource, and the requesting end and the server are also reported.
  • the viewing information such as the name of the live/on-demand program viewed by the requesting end, the total length, the current playing frame, and the like.
  • the requesting end When the requesting end is a terminal, the requesting end also reports its port information to the P2P server.
  • the P2P server also receives and stores the port information reported by the server, where the port information includes the public network port of the router mapped by the private port of the server, and the requesting end obtains the router corresponding to the server from the P2P server.
  • the public network port sends a peer-to-peer network connection request to the public network port of the router in the connection request module 12.
  • the requesting end and the server end exchange information through the P2P server, that is, the requesting end obtains the resource information and the port information of the server, and the server can also obtain the resource request information, the viewing information, the port information, and the like of the requesting end.
  • the requesting end and the server may report the resource request information to the P2P server by using any one of UTP, HTTP, and Websocket protocols.
  • the requesting end sends the peer-to-peer network connection request to the public network port of the router corresponding to the server, and after receiving the peer-to-peer network connection request of the requesting end, the router automatically according to the private port of the server and the public of the router.
  • the mapping of network ports forwards peer-to-peer network connection requests to the server. For example, when the server is located in the company's LAN, the private port of the server refers to the intranet port of the server, and the public port refers to the external port of the company router.
  • connection establishment module 13 when the server receives the peer-to-peer network connection request sent by the requesting end, The response will be answered according to the actual situation. If the server agrees to establish a connection, it will feed back a response message to the requesting end. The feedback path of the response message of the server responding to the peer network request is forwarded to the public network port of its corresponding router. The requesting end, after receiving the response message, the requesting end successfully establishes a peer-to-peer network connection with the server.
  • a supplementary connection mode is provided, and the peer-to-peer network connection request of the requesting end is forwarded to the private port of the server through the public network port of the router, thereby establishing the requesting end and the service. Peer-to-peer network connection.
  • the peer-to-peer network connection device provided by the embodiment of the present application is applicable to the requesting end of the P2P network system, and the requesting end and the server end may be terminal devices such as a mobile phone, a computer, a cloud video terminal, and a television, and the requesting end may also be an HTML5 webpage.
  • the user performs online video on demand through the HTML5 webpage. Since the HTML5 webpage runs in the browser, it does not have access to local information, and when it is in the private network, it cannot perform port mapping with the router, and thus cannot provide port information for receiving peer network connection request.
  • the peer-to-peer network connection request can only be initiated to other terminals in the P2P network system, and the peer-to-peer network connection request sent by other terminals cannot be accepted.
  • the requesting end provided by the embodiment of the present application is also applicable to other types of requesting ends, so as to establish a peer-to-peer network connection of each terminal in the private network in the P2P network system.
  • the peer-to-peer network connection apparatus provided by the embodiment of the present application further includes:
  • the data transmission module 14 is configured to receive, according to the public network port of the router mapped by the private port of the server included in the port information, the resource sent by the server forwarded by the router.
  • the resource can be shared between the requesting end and the server.
  • the requesting end receives the resource sent by the server, the requesting end passes the router corresponding to the server.
  • the public network port receives the resource sent by the server forwarded by the router.
  • the requesting end uses the Websocket protocol to communicate with the server.
  • the requesting end and the server can perform two-way communication, that is, The requesting end may receive the resource in the server that is forwarded by the router corresponding to the server, and the requesting end may forward the resource to the server through the public network port of the router corresponding to the server.
  • the establishment of the peer-to-peer network connection has active and passive points, and after the connection is successfully established, the requesting end and the server end can realize two-way communication, no longer active and passive. This is different from the existing HTTP protocol and other one-way communication protocols, making resource sharing between terminals in the P2P network system more flexible and convenient.
  • the requesting end may first download a buffer resource of a predetermined length from the node server of the CDN before performing the peer-to-peer network connection; and downloading the buffer resource is completed. Afterwards, the resource after the buffer resource is configured as a request resource into the resource request information.
  • the requesting end first requests a part of the buffering resource from the node server in the CDN architecture. For example, when the requesting end views a movie, the requesting end can first download the buffered data for 10s in the node server. With the buffering time of 10s, the requesting end can pass the P2P in the buffering time. The way continues to look for resources, that is, resources after buffering resources.
  • the resource request information may be used to segment the resources required by the requesting end, and may respectively initiate a peer-to-peer network connection request to different server terminals according to the resource information of each server obtained from the P2P server, and obtain resources in a distributed manner. Improve the speed of resource acquisition.
  • an embodiment of the present application provides a peer-to-peer network connection device, which is configured in a server of a P2P network system, and includes:
  • the information generating module 21 is configured to generate port information according to a public network port of the router mapped by the private port;
  • the information reporting module 22 is configured to report the resource information and the port information to the P2P server.
  • the response module 23 is configured to, when receiving the peer-to-peer network connection request sent by the requesting end, forward the response message in response to the peer-to-peer network connection request to the public network port of the router mapped by the private port of the server to The requesting end, and establishing a peer-to-peer network connection with the requesting end;
  • the router After the peer-to-peer network connection request is obtained by the requesting end, after obtaining the port information of the server that is required by the P2P server and including the resource required by the requesting end, the router is configured according to the private port of the server included in the port information.
  • the public network port is sent to the public network port of the router, and is forwarded by the router to the server according to the private port of the server mapped by the public network port of the router.
  • the peer-to-peer network connection device provided in this embodiment is applicable to the server in the P2P network system.
  • the server configures the public network port of the router mapped by the private port to the port information.
  • the server maps its port 5000 to the port 8000 of the router, and the address of the port 8000 of the router is configured to the port information.
  • the port information and the resource information of the server are reported to the P2P server through any one of the UTP, HTTP, and Websocket protocols, and the requesting end obtains the port information and the resource information of the server from the P2P server.
  • connection request if the server needs to cache the resources required by the requesting end, the requesting end knows the public network port of the router corresponding to the server according to the port information of the server, and the peer-to-peer network connection request of the requesting end is sent to the corresponding server. On the public network port of the router, the router automatically forwards the peer-to-peer network connection request from the requesting end to the server.
  • the response module After receiving the peer network connection request of the requesting end forwarded by the router, if the response module agrees to establish a connection, the response message is forwarded to the requesting end through the public network port of the router, and after the requesting end receives the response message from the server, the requesting end
  • the server can successfully establish a peer-to-peer network connection and can start to transmit resources in both directions.
  • mapping relationship between the private port of the information generating module 21 and the public network port of the router can be established in various manners.
  • the information generating module 21 will be described in detail below with reference to an embodiment.
  • the information generating module 21 is configured to generate port information according to the public network port allocated by the router to the private port of the server.
  • the router can automatically allocate a public network port to each terminal in the private network according to the idle state of the public network port, and feed back the mapping relationship between the public network port and the private port of the terminal to the terminal.
  • the information generating module 21 Generating port information based on the information of the public port of the router whose private port is mapped according to the mapping relationship between the private port of the router and the public port of the router.
  • the UPNP protocol can be used for network address translation, the network address of the private port of the server is mapped to the public network port of the router, and the network address of the public network port of the router is configured into the port information.
  • the server in the private network may also request the router to provide a public network port through the UPNP protocol to perform mapping of the private port of the server.
  • the peer-to-peer network connection request is sent to the public network port of the router according to the network address of the public network port of the router in the port information of the server, and the public network port
  • the peer-to-peer network connection request is forwarded to the server, so that the server receives the peer-to-peer network connection request of the requesting end.
  • the embodiment of the present application provides a technical solution that the server receives the peer-to-peer network connection request of the requesting end and successfully feeds back the response message to the requesting end to establish a peer-to-peer network connection with the requesting end.
  • an embodiment of the present application provides a peer-to-peer network connection device, which is configured in a P2P network system.
  • the router including:
  • the request receiving module 31 is configured to receive a peer-to-peer network connection request sent by the requesting end, where the peer-to-peer network connection request is obtained by the requesting end after acquiring the port information of the server that is required by the P2P server and includes the resource required by the requesting end And sending, according to the public network port of the router mapped by the private port of the server included in the port information, to the public network port of the router;
  • the forwarding module 32 is configured to forward the peer-to-peer network connection request to the server according to the private port of the server that is mapped by the public network port of the router;
  • the forwarding module 32 is further configured to receive a response message sent by the server in response to the peer network connection request sent by the requesting end, and forward the response message to the requesting end, to facilitate the request After receiving the response message of the server forwarded by the router, the terminal establishes a peer-to-peer network connection with the server.
  • the peer-to-peer network connection device is applicable to a router in a P2P network system, and the router receives the peer-to-peer network connection request sent by the requesting end, and forwards the received peer-to-peer network connection request to the server.
  • the requesting end first obtains the public network port of the router corresponding to the server according to the port information of the server that is provided by the P2P server, and then sends the peer network connection request to the router according to the obtained port information.
  • the router After receiving the peer network request sent by the requesting end, the router forwards the peer network connection request to the server according to the mapping between the public port of the router and the private port of the server.
  • the server After receiving the peer-to-peer network connection request, the server sends a response message in response to the peer-to-peer network connection request, and the response message sent by the server is sent to the public network port of the router, and the router automatically sends the response sent by the server.
  • the message is forwarded to the requesting end.
  • the requesting end and the server successfully establish a peer-to-peer network connection, and can perform two-way resource sharing.
  • the router can still Undertake the function of forwarding to ensure smooth communication between the requester and the server.
  • the embodiment of the present application further provides a peer-to-peer network connection system, including a requesting end, a server, and a router, where the requesting end is used to initiate a peer-to-peer network to the server according to the peer-to-peer network connection method shown in FIG. 1 and 2.
  • the server is configured to respond to the peer-to-peer network connection request of the requesting end according to the peer-to-peer network connection method shown in FIG. 3, and the router is configured to forward the request according to the peer-to-peer network connection method shown in FIG. Peer-to-peer network request and response message from the server.
  • an electronic device including the peer-to-peer network connection device described in any of the foregoing embodiments of the embodiment shown in FIG. 5 or FIG.
  • a non-transitory computer readable storage medium in another embodiment, storing computer executable instructions executable as shown in FIG. 1 or The peer-to-peer network connection method in any of the method embodiments described in the embodiment shown in FIG. 2.
  • FIG. 9 is a schematic diagram showing the hardware structure of an electronic device for performing the peer-to-peer network connection method according to the embodiment shown in FIG. 1 or FIG. 2 according to an embodiment of the present disclosure. As shown in FIG. 9, the device includes:
  • processors 910 and memory 920 one processor 910 is taken as an example in FIG.
  • the apparatus for performing the peer-to-peer network connection method described in the embodiment shown in FIG. 1 or FIG. 2 may further include: an input device 930 and an output device 940.
  • the processor 910, the memory 920, the input device 930, and the output device 940 may be connected by a bus or other means, as exemplified by a bus connection in FIG.
  • the memory 920 is used as a non-transitory computer readable storage medium for storing non-volatile software programs, non-volatile computer executable programs, and modules, as described in the embodiment shown in FIG. 1 or FIG. 2 of the present application.
  • a program instruction/module corresponding to the peer-to-peer network connection method (for example, the information acquisition module 11, the connection request module 12, and the connection establishment module 13 shown in FIG. 5).
  • the processor 910 executes various functional applications and data processing of the server by executing non-volatile software programs, instructions, and modules stored in the memory 920, that is, implementing the method described in the foregoing embodiment of FIG. 1 or FIG. Embodiment Peer-to-peer network connection method.
  • the memory 920 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function; and the storage data area may store the pair according to the embodiment shown in FIG. 5 or FIG. Data created by the use of network connection devices, etc.
  • memory 920 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device.
  • memory 920 can optionally include memory remotely disposed relative to processor 910, which can be connected via a network to a peer to peer network connection device as described in the embodiment of FIG. 5 or 6. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • Input device 930 can receive input numeric or character information and generate key signal inputs related to user settings and function control of the peer to peer network connection device described in the embodiment of FIG. 5 or 6.
  • Output Device 940 can include a display device such as a display screen.
  • the one or more modules are stored in the memory 920, and when executed by the one or more processors 910, perform a pair of any of the method embodiments described in the above-described embodiment of FIG. 1 or FIG. And other network connection methods.
  • the electronic device of the embodiment of the present application exists in various forms, including but not limited to:
  • Mobile communication devices These devices are characterized by mobile communication functions and are mainly aimed at providing voice and data communication.
  • Such terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
  • Ultra-mobile personal computer equipment This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has mobile Internet access.
  • Such terminals include: PDAs, MIDs, and UMPC devices, such as the iPad.
  • Portable entertainment devices These devices can display and play multimedia content. Such devices include: audio, video players (such as iPod), handheld game consoles, e-books, and smart toys and portable car navigation devices.
  • the server consists of a processor, a hard disk, a memory, a system bus, etc.
  • the server is similar to a general-purpose computer architecture, but because of the need to provide highly reliable services, processing power and stability High reliability in terms of reliability, security, scalability, and manageability.
  • an electronic device including the peer-to-peer network connection device described in any of the foregoing embodiments of the embodiment shown in FIG.
  • a non-transitory computer readable storage medium is also provided, the non-transitory computer readable storage medium storing computer executable instructions executable as shown in FIG. 3 above.
  • a peer to peer network connection method in any of the method embodiments described in the embodiments.
  • FIG. 10 is a peer-to-peer network connection method for performing the embodiment shown in FIG. 3 according to an embodiment of the present application.
  • processors 1010 and a memory 1020 are illustrated by one processor 1010 in FIG.
  • the apparatus for performing the peer-to-peer network connection method described in the embodiment shown in FIG. 3 may further include: an input device 1030 and an output device 1040.
  • the processor 1010, the memory 1020, the input device 1030, and the output device 1040 may be connected by a bus or other means, as exemplified by a bus connection in FIG.
  • the memory 1020 is a non-transitory computer readable storage medium for storing non-volatile software programs, non-volatile computer executable programs, and modules, such as the peer-to-peer network described in the embodiment shown in FIG. 3 of the present application.
  • the program instructions/modules corresponding to the connection method for example, the information generating module 21, the information reporting module 22, and the response module 23 shown in FIG. 7).
  • the processor 1010 performs various functional applications and data processing of the server by running non-volatile software programs, instructions, and modules stored in the memory 1020, that is, implementing the method embodiments described in the foregoing embodiment shown in FIG. And other network connection methods.
  • the memory 1020 can include a storage program area and a storage data area, wherein the storage program area can store an operating system, an application required for at least one function; and the storage data area can store the peer-to-peer network connection according to the embodiment shown in FIG. Data created by the use of the device, etc.
  • memory 1020 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device.
  • memory 1020 can optionally include memory remotely disposed relative to processor 1010, which can be connected to the peer to peer network connection device described in the embodiment of FIG. 7 over a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • Input device 1030 can receive input numeric or character information and generate key signal inputs related to user settings and function control of the peer to peer network connection device described in the embodiment of FIG.
  • the output device 1040 can include a display device such as a display screen.
  • the one or more modules are stored in the memory 1020, and when executed by the one or more processors 1010, perform peer-to-peer network connections in any of the method embodiments described in the embodiment of FIG. method.
  • the above product can perform the method provided by the embodiment shown in FIG. 3 of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
  • the method provided by the embodiment shown in FIG. 3 of the present application can perform the method provided by the embodiment shown in FIG. 3 of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
  • the electronic device of the embodiment of the present application exists in various forms, including but not limited to:
  • Mobile communication devices These devices are characterized by mobile communication functions and are mainly aimed at providing voice and data communication.
  • Such terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
  • Ultra-mobile personal computer equipment This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has mobile Internet access.
  • Such terminals include: PDAs, MIDs, and UMPC devices, such as the iPad.
  • Portable entertainment devices These devices can display and play multimedia content. Such devices include: audio, video players (such as iPod), handheld game consoles, e-books, and smart toys and portable car navigation devices.
  • the server consists of a processor, a hard disk, a memory, a system bus, etc.
  • the server is similar to a general-purpose computer architecture, but because of the need to provide highly reliable services, processing power and stability High reliability in terms of reliability, security, scalability, and manageability.
  • an electronic device including the peer-to-peer network connection device described in any of the foregoing embodiments of the embodiment shown in FIG.
  • a non-transitory computer readable storage medium is further provided, the non-transitory computer readable storage medium storing computer executable instructions executable as shown in FIG.
  • a peer-to-peer network connection method in any of the method embodiments described in the embodiments.
  • FIG. 11 is a schematic diagram showing the hardware structure of an electronic device for performing the peer-to-peer network connection method according to the embodiment shown in FIG. 4 according to an embodiment of the present disclosure. As shown in FIG. 11, the device includes:
  • processors 1110 and a memory 1120 are illustrated by one processor 1110 in FIG.
  • the apparatus for performing the peer-to-peer network connection method described in the embodiment shown in FIG. 4 may further include: an input device 1130 and an output device 1140.
  • the processor 1110, the memory 1120, the input device 1130, and the output device 1140 may be connected by a bus or other means, and the bus connection is taken as an example in FIG.
  • the memory 1120 is a non-transitory computer readable storage medium that can be used to store non-volatile soft Program program, non-volatile computer executable program and module, such as the program instruction/module corresponding to the peer-to-peer network connection method described in the embodiment shown in FIG. 4 (for example, the request receiving module 31 shown in FIG. 8) And forwarding module 32).
  • the processor 1110 performs various functional applications and data processing of the server by executing non-volatile software programs, instructions, and modules stored in the memory 1120, that is, implementing the method embodiments described in the foregoing embodiment shown in FIG. And other network connection methods.
  • the memory 1120 can include a storage program area and a storage data area, wherein the storage program area can store an operating system, an application required for at least one function; and the storage data area can store the peer-to-peer network connection according to the embodiment shown in FIG. Data created by the use of the device, etc.
  • memory 1120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device.
  • the memory 1120 can optionally include memory remotely located relative to the processor 1110 that can be connected via a network to the peer to peer network connection device described in the embodiment of FIG. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • Input device 1130 can receive input numeric or character information and generate key signal inputs related to user settings and function control of the peer to peer network connection device described in the embodiment of FIG.
  • the output device 1140 may include a display device such as a display screen.
  • the one or more modules are stored in the memory 1120, and when executed by the one or more processors 1110, perform peer-to-peer network connections in any of the method embodiments described in the above-described embodiment of FIG. method.
  • the above product can perform the method provided by the embodiment shown in FIG. 4 of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
  • the method provided by the embodiment shown in FIG. 4 of the present application can perform the method provided by the embodiment shown in FIG. 4 of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
  • the electronic device of the embodiment of the present application exists in various forms, including but not limited to:
  • Mobile communication devices These devices are characterized by mobile communication functions and are mainly aimed at providing voice and data communication.
  • Such terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
  • Ultra-mobile personal computer equipment This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has mobile Internet access.
  • Such terminals include: PDAs, MIDs, and UMPC devices, such as the iPad.
  • Portable entertainment devices These devices can display and play multimedia content. Such devices include: audio, video players (such as iPod), handheld game consoles, e-books, and smart toys and portable car navigation devices.
  • the server consists of a processor, a hard disk, a memory, a system bus, etc.
  • the server is similar to a general-purpose computer architecture, but because of the need to provide highly reliable services, processing power and stability High reliability in terms of reliability, security, scalability, and manageability.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.

Landscapes

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

Abstract

本申请实施例提供一种对等网络连接方法及装置,包括:请求端获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息,所述端口信息包括服务端的私有端口映射的路由器的公网端口;所述请求端向所述路由器的公网端口发送对等网络连接请求,由所述路由器将所述对等网络连接请求转发至所述服务端;所述请求端在接收到所述路由器转发的所述服务端的应答消息后,建立与所述服务端的对等网络连接。本申请实施例提供的对等网络连接方法及装置,为现有的P2P网络系统提供了一种连接方式,以避免因现有连接方式的局限性造成连接失败率或连接中断率过高的问题,从而提高P2P网络系统分担资源服务器压力的能力。

Description

一种对等网络连接方法及装置
本申请要求于2015年12月29日提交中国专利局、申请号为201511020640.X、申请名称为“一种对等网络连接方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及网络通信技术领域,尤其涉及一种对等网络连接方法及装置。
背景技术
为了提高网络直播或点播过程中资源播放的流畅性,传统的解决方案针对资源服务器进行了改进。但改进方案的网络架构中只有资源服务器在向用户提供数据,即使花费高昂的成本进行资源服务器的升级,还是无法满足日益增多的用户需求。
为了弥补上述方案的缺陷,现有技术的另一种方案中采用P2P对等网络连接方式,请求端和服务端建立对等连接后可进行资源的共享,这样,请求端就无需再持续向资源服务器请求数据了,从而分担了资源服务器的一部分压力。但是,现有技术中P2P网络系统中通常采用Webrtc连接协议进行对等连接,这种连接协议由于网络稳定性、路由器支持限制等原因发生连接中断或连接失败的情况较多,分担资源服务器压力的效果并不理想。
发明内容
本申请实施例提供一种对等网络连接方法及装置,用以解决现有技术中P2P网络系统中请求端和服务端连接中断或连接失败概率较高的问题。
第一方面,本申请实施例提供一种对等网络连接方法,包括:
请求端获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息,所述端口信息包括服务端的私有端口映射的路由器的公网端口;
所述请求端向所述路由器的公网端口发送对等网络连接请求,由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接 请求转发至所述服务端;
所述请求端在接收到所述路由器转发的所述服务端响应所述对等网络连接请求的应答消息后,建立与所述服务端的对等网络连接。
第二方面,本申请实施例提供一种对等网络连接方法,包括:
服务端根据其私有端口映射的路由器的公网端口生成端口信息;
所述服务端将资源信息及端口信息上报至P2P服务器;
所述服务端在接收到请求端发送的对等网络连接请求时,将响应所述对等网络连接请求的应答消息通过所述服务端的私有端口映射的所述路由器的公网端口转发至所述请求端,并建立与所述请求端的对等网络连接;
其中,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送,并由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口转发至所述服务端。
第三方面,本申请实施例提供一种对等网络连接方法,包括:
路由器接收请求端发送的对等网络连接请求,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送的;
所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
所述路由器接收所述服务端发送的响应所述请求端发送的对等网络连接请求的应答消息,并将所述应答消息转发至所述请求端,以便于所述请求端在接收到所述路由器转发的所述服务端的应答消息后,建立与所述服务端的对等网络连接。
第四方面,本申请实施例提供一种对等网络连接装置,包括:
信息获取模块,用于获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息,所述端口信息包括服务端的私有端口映射的路由器的公网端口;
连接请求模块,用于向所述路由器的公网端口发送对等网络连接请求,由所 述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
连接建立模块,用于在接收到所述路由器转发的所述服务端响应所述对等网络连接请求的应答消息后,建立与所述服务端的对等网络连接。
第五方面,本申请实施例提供一种对等网络连接装置,包括:
信息生成模块,用于根据其私有端口映射的路由器的公网端口生成端口信息;
信息上报模块,用于将资源信息及端口信息上报至P2P服务器;
响应模块,用于在接收到请求端发送的对等网络连接请求时,将响应所述对等网络连接请求的应答消息通过所述服务端的私有端口映射的所述路由器的公网端口转发至所述请求端,并建立与所述请求端的对等网络连接;
其中,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送,并由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口转发至所述服务端。
第六方面,本申请实施例提供一种对等网络连接装置,包括:
请求接收模块,用于接收请求端发送的对等网络连接请求,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送的;
转发模块,用于根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
所述转发模块,还用于接收所述服务端发送的响应所述请求端发送的对等网络连接请求的应答消息,并将所述应答消息转发至所述请求端,以便于所述请求端在接收到所述路由器转发的所述服务端的应答消息后,建立与所述服务端的对等网络连接。
本申请实施例提供一种非暂态计算机可读存储介质,其中,该非暂态计算机可读存储介质可存储有计算机指令,该计算机指令执行时可实现本申请第一方面 实施例提供的对等网络连接方法的各实现方式中的部分或全部步骤。
本申请实施例提供一种电子设备,包括:一个或多个处理器;以及,存储器;其中,所述存储器存储有可被所述一个或多个处理器执行的指令,所述指令被设置为用于执行本申请第一方面实施例任一项对等网络连接方法。
本申请实施例提供一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行本申请第一方面实施例任一项对等网络连接方法。
本申请实施例提供一种非暂态计算机可读存储介质,其中,该非暂态计算机可读存储介质可存储有计算机指令,该计算机指令执行时可实现本申请第二方面实施例提供的对等网络连接方法的各实现方式中的部分或全部步骤。
本申请实施例提供一种电子设备,包括:一个或多个处理器;以及,存储器;其中,所述存储器存储有可被所述一个或多个处理器执行的指令,所述指令被设置为用于执行本申请第二方面实施例任一项对等网络连接方法。
本申请实施例提供一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行本申请第二方面实施例任一项对等网络连接方法。
本申请实施例提供一种非暂态计算机可读存储介质,其中,该非暂态计算机可读存储介质可存储有计算机指令,该计算机指令执行时可实现本申请第三方面实施例提供的对等网络连接方法的各实现方式中的部分或全部步骤。
本申请实施例提供一种电子设备,包括:一个或多个处理器;以及,存储器;其中,所述存储器存储有可被所述一个或多个处理器执行的指令,所述指令被设置为用于执行本申请第三方面实施例任一项对等网络连接方法。
本申请实施例提供一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行本申请第三方面实施例任一项对等网络连接方法。
本申请实施例提供的对等网络连接方法及装置,通过将请求端的连接请求经 路由器的公网端口转发至服务端的私有端口,解决了现有技术中由于路由器限制等原因造成的请求端无法实现与私有网络中的服务端建立对等网络连接的问题。为现有的P2P网络系统提供了一种补充连接方式,以避免因现有连接方式的局限性造成连接失败率或连接中断率过高的问题,从而提高P2P网络系统分担资源服务器压力的能力。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例对等网络连接方法流程图;
图2为本申请实施例对等网络连接方法实施例流程图;
图3为本申请实施例对等网络连接方法流程图;
图4为本申请实施例对等网络连接方法流程图;
图5为本申请实施例对等网络连接装置的结构示意图;
图6为本申请实施例对等网络连接装置的实施例结构示意图;
图7为本申请实施例对等网络连接装置的结构示意图;
图8为本申请实施例对等网络连接装置的结构示意图;
图9为本申请实施例提供的一种电子设备的结构示意图;
图10为本申请实施例提供的另一种电子设备的结构示意图;
图11为本申请实施例提供的又一种电子设备的结构示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都 属于本申请保护的范围。
本申请实施例提供的对等网络连接方法及装置,可应用于网络直播/点播场景中。现有技术中,当用户通过HTML5网页端中的播放器(请求端)发起视频播放请求时,通常采用Webrtc协议与服务端建立对等网络连接,当请求端向P2P服务器发起与服务端的连接请求后,P2P服务器将服务端对应的端口地址返回给请求端,继而请求端根据服务端的端口地址与服务端建立连接。但是,WERTC协议只适用于服务端的端口地址为公网端口的情况,基于Webrtc协议,请求端与服务端仅能通过直接寻址的方式建立连接。因此,当服务端处于私网中时,请求端无法通过Webrtc协议建立与服务端的连接,直播/点播资源也就无法在请求端和服务端之间实现共享,这种情况下,请求端只能向资源服务器请求数据,服务端无法发挥分担资源服务器压力的作用。
本申请实施例提供的对等网络连接方法及装置,正是要改变Webrtc协议存在的上述缺陷,提供补充的连接方案。请求端将连接请求通过路由器的公网端口转发至服务端的私有端口,从而,可在服务端处于私网的场景下,实现请求端与服务端的对等连接。
另外,本申请实施例提供的对等网络连接方法及装置,还可应用于其它需要与私有网络中的终端建立网络连接的场景,本申请实施例对此不作限定。
参考图1,本申请实施例提供一种对等网络连接方法,包括:
S101,请求端获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息,所述端口信息包括服务端的私有端口映射的路由器的公网端口;
S102,所述请求端向所述路由器的公网端口发送对等网络连接请求,由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
S103,所述请求端在接收到所述路由器转发的所述服务端响应所述对等网络连接请求的应答消息后,建立与所述服务端的对等网络连接。
其中,步骤S101中的P2P服务器中预先接收并存储了请求端上报的资源请求信息,资源请求信息包括所需资源的名称、内容、长度等,还存储有请求端和服务端上报的观影信息,例如请求端所观看的直播/点播节目的名称、总长度、当前播放帧等。当所述请求端为终端时,所述请求端还会将其端口信息上报至所 述P2P服务器。另外,P2P服务器中还接收并存储了服务端上报的端口信息,端口信息中包括服务端的私有端口映射的路由器的公网端口,请求端将从所述P2P服务器中获取到服务端对应的路由器的公网端口,并在S102中将对等网络连接请求发送至路由器的公网端口。
请求端和服务端将通过P2P服务器进行信息交换,即请求端获取到服务端的资源信息及端口信息,服务端也可获知请求端的资源请求信息、观影信息、端口信息等。请求端和服务端向P2P服务器上报资源请求信息可使用UTP、HTTP、Websocket协议中的任意一种。
步骤S102中,请求端将对等网络连接请求发送至服务端对应的路由器的公网端口,路由器在接收到请求端的对等网络连接请求后,会自动根据服务端的私有端口与路由器的公网端口的映射关系将对等网络连接请求转发至服务端。例如,当服务端位于公司的局域网内时,服务端的私有端口指的便是服务端的内网端口,而公网端口则指公司路由器的对外端口。
S103中,在服务端接收到请求端发送的对等网络连接请求时,会根据实际情况进行应答,如果服务端同意建立连接,则会向请求端反馈应答消息,服务端响应所述对等网络请求的应答消息的反馈路径是通过其对应的路由器的公网端口转发至请求端,请求端在收到所述应答消息后,成功建立起与所述服务端的对等网络连接。
本实施例中,针对服务端处于私网中的情况,提供了一种补充连接方式,将请求端的对等网络连接请求经路由器的公网端口转发至服务端的私有端口,从而建立请求端与服务端的对等网络连接。
本申请实施例提供的对等网络连接方法中,所述请求端和服务端可以是手机、电脑、云视频终端、电视等终端设备,而请求端还可以是HTML5网页端,例如用户通过HTML5网页端进行在线视频点播。由于HTML5网页端运行在浏览器中,其没有访问本地信息的权限,且当其处于私网中时,无法进行与路由器的端口映射,也就无法提供用于接收对等网络连接请求的端口信息,因此,请求端为HTML5网页端时,只能主动向处于P2P网络系统中的其它终端发起对等网络连接请求,而无法接受其它终端发出的对等网络连接请求。当然,本申请实施例提供的对等网络连接方法也适用于其它类型的请求端,以建立起P2P网络系统中处于私网中的各终端的对等网络连接。
参考图2,本申请实施例提供的对等网络连接方法中,S103之后,还包括:
S104,所述请求端根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,接收所述路由器转发的所述服务端发送的资源。
在S103中成功建立起请求端和服务端的对等网络连接之后,请求端和服务端之间可进行资源的共享,请求端接收服务端发送的资源时,通过服务端对应的路由器的公网端口,接收所述路由器转发的所述服务端发送的资源。而且,当服务端的私有端口上开启Websocket协议时,请求端采用Websocket协议与服务端进行通信,在请求端和服务端成功建立起对等网络连接之后,请求端和服务端可进行双向通信,即请求端可接收服务端对应的路由器转发的所述服务端中的资源,请求端也可将其资源经服务端对应的路由器的公网端口转发至服务端。基于此,对于请求端为HTML5网页端的场景下,对等网络连接的建立具有主动和被动之分,而成功建立连接后,请求端和服务端将可实现双向通信,不再有主动和被动之分,这区别于现有的HTTP协议和其它单向通信协议,使P2P网络系统中各终端之间的资源共享更加灵活方便。
当本申请实施例应用于请求端为播放器的场景中时,在执行对等网络连接之前,请求端可先从CDN的节点服务器中下载预定长度的缓冲资源;并在所述缓冲资源下载完成后,将所述缓冲资源之后的资源作为请求资源配置到所述资源请求信息中。
请求端首先向CDN架构中的节点服务器请求一部分缓冲资源,例如请求端观看一部影片时可先供节点服务器中下载10s的缓冲数据,利用10s的缓冲时间,请求端可在缓冲时间内通过P2P方式继续寻找资源,即缓冲资源之后的资源。所述资源请求信息中可将请求端所需的资源进行分段,可根据从P2P服务器中获取的各服务端的资源信息向不同的服务端分别发起对等网络连接请求,分散式获取资源,以提高资源获取的速度。
参考图3,本申请实施例还提供一种对等网络连接方法,包括:
S201,服务端根据其私有端口映射的路由器的公网端口生成端口信息;
S202,所述服务端将资源信息及端口信息上报至P2P服务器;
S203,所述服务端在接收到请求端发送的对等网络连接请求时,将响应所述对等网络连接请求的应答消息通过所述服务端的私有端口映射的所述路由器的 公网端口转发至所述请求端,并建立与所述请求端的对等网络连接;
其中,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送,并由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口转发至所述服务端。
S201中,当所述服务端处于私网中时,服务端将其私有端口映射的路由器的公网端口配置到端口信息中,例如,当服务端处于公司局域网中,服务端将其端口5000映射到路由器的端口8000,路由器的端口8000的地址等信息将配置到端口信息。步骤S202中,服务端的端口信息和资源信息将通过UTP、HTTP、Websocket协议中的任意一中上报至P2P服务器,请求端将从所述P2P服务器中获取到服务端的端口信息以及资源信息,并根据服务端的资源信息判断是否发送向其发送对等网络连接请求,如果服务端中缓存有请求端所需的资源,则请求端会根据服务端的端口信息获知服务端对应的路由器的公网端口,请求端的对等网络连接请求将发送至服务端对应的路由器的公网端口,路由器会自动将请求端的对等网络连接请求转发至服务端。
S203中,服务端接收到路由器转发的请求端的对等网络连接请求后,如果同意建立连接,则将应答消息通过路由器的公网端口转发至请求端,在请求端收到服务端的应答消息后,请求端和服务端可成功建立对等网络连接,并可开始双向传输资源。
服务端的私有端口和路由器的公网端口的映射关系建立可采用多种方式,以下再以一实施例对S201进行举例说明。
S201包括:所述服务端根据所述路由器为所述服务端的私有端口分配的公网端口生成端口信息。
路由器可根据其各公网端口的闲置情况自动为处于私网中的各终端分配公网端口,并将公网端口与终端的私有端口的映射关系反馈至终端,本实施例中,服务端根据获知的其私有端口与路由器的公网端口的映射关系,将其私有端口映射的路由器的公网端口的信息生成端口信息。例如,可采用UPNP协议进行网络地址转换,将所述服务端的私有端口的网络地址映射到路由器的公网端口,并将所述路由器的公网端口的网络地址配置到所述端口信息中。
本实施例中,还可由处于私网中的服务端通过UPNP协议请求路由器提供一公网端口以进行服务端私有端口的映射。请求端发送对等连接请求时,将根据所述服务端的端口信息中的路由器的公网端口的网络地址将所述对等网络连接请求发送至所述路由器的公网端口,公网端口则将所述对等网络连接请求转发至服务端,从而所述服务端接收到所述请求端的对等网络连接请求。
本申请实施例针对服务端处于私网中的场景,提供了一种服务端接收请求端的对等网络连接请求,并成功向请求端反馈应答消息以实现建立与请求端的对等网络连接的技术方案,为P2P网络系统中各终端处于不同网络场景中时提供了一种补充的网络连接方式,使得各终端可不受私网的限制,发挥服务端的功能,使得P2P网络系统中的资源共享更加方便,扩大了资源共享的适用范围。
参考图4,本申请的实施例提供一种对等网络连接方法,包括:
S301,路由器接收请求端发送的对等网络连接请求,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送的;
S302,所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
S303,所述路由器接收所述服务端发送的响应所述请求端发送的对等网络连接请求的应答消息,并将所述应答消息转发至所述请求端,以便于所述请求端在接收到所述路由器转发的所述服务端的应答消息后,建立与所述服务端的对等网络连接。
本实施例中,路由器接收请求端发送的对等网络连接请求,并将接收到的对等网络连接请求转发至服务端。由请求端先根据P2P服务器提供的包含请求端所需资源的服务端的端口信息获取到服务端对应的路由器的公网端口,之后再根据获取到的端口信息将对等网络连接请求发送至路由器的公网端口,路由器在接收到请求端发送的对等网络请求后,根据路由器的公网端口与服务端的私有端口的映射关系,将对等网络连接请求转发至服务端。
服务端在接收到对等网络连接请求后,会发出响应所述对等网络连接请求的应答消息,服务端发出的应答消息将发送至路由器的公网端口,路由器在会自动 将服务器发送的应答消息转发至请求端,至此,在路由器的转发帮助下,请求端和服务端成功建立起对等网络连接,并可进行双向的资源共享,请求端与服务端进行资源共享过程中,路由器可依然承担转发的功能,以保证请求端和服务端的顺畅通信。
以下以HTML5网页端作为请求端,处于私网中的电脑作为服务端为例进行本申请实施例的详细解释。
用户通过HTML5网页端中的播放器请求观看一部电影,在播放器中选择播放的影片后,播放器首先向CDN架构中的节点服务器请求下载10s的缓冲资源,下载完成后,播放器开始播放缓冲资源,播放器将在10s的缓冲时间内,通过对等网络连接的方式获取所述电影的资源,P2P网络系统中,网页端中的播放器(请求端)和各终端的播放器(服务端)均将观影信息上报至P2P服务器,观影信息中包含请求端或服务端的资源、端口、观看进度等等信息,观影信息为请求端和服务端提供了配对依据。例如,请求端获知服务端A、B和C中包含所述电影的资源,请求端分别向服务端A、B、C发起基于Webrte和Websocket协议的对等网络连接请求,服务端A、C处于公网中,请求端可与服务端A、C成功建立基于Webrtc协议的对等网络连接;服务端B处于私网中,请求端发起的基于Webrtc协议的连接请求失败,请求端通过解析P2P服务器提供的服务端B的端口信息,将基于Websocket协议的连接请求通过服务端B对应的路由器的公网端口转发至服务端B,服务端B在接收到请求端发送的对等网络连接请求后,将应答消息通过路由器的公网端口反馈给所述请求端,在获得服务端B反馈的应答消息后,请求端与服务端B成功建立了基于Websocket协议的对等网络连接。对于请求端来说,其采用两种协议分别向各服务端发起请求连接,在一种连接请求失败或中断的情况下,另一种连接请求可作为补充连接,从而提高了P2P方式进行资源获取的成功率,增大了P2P方式获取的资源量在网页端所需总资源量中所占的比例,进而减小了CDN架构的服务压力,基于Webrtc和Websocket协议的两种连接请求相互独立,相互补充,为P2P方式提供了更优化的连接方案。
最后需要说明的是,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非暂态计算机可读存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的非暂态计算机可读存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access  Memory,RAM)等。
参考图5,本申请实施例提供一种对等网络连接装置,配置在P2P网络系统的请求端中,包括:
信息获取模块11,用于获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息,所述端口信息包括服务端的私有端口映射的路由器的公网端口;
连接请求模块12,用于向所述路由器的公网端口发送对等网络连接请求,由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
连接建立模块13,用于在接收到所述路由器转发的所述服务端响应所述对等网络连接请求的应答消息后,建立与所述服务端的对等网络连接。
其中,P2P服务器中预先接收并存储了本实施例中的对等网络连接装置上报的资源请求信息,资源请求信息包括所需资源的名称、内容、长度等,还存储有请求端和服务端上报的观影信息,例如请求端所观看的直播/点播节目的名称、总长度、当前播放帧等。当所述请求端为终端时,所述请求端还会将其端口信息上报至所述P2P服务器。另外,P2P服务器中还接收并存储了服务端上报的端口信息,端口信息中包括服务端的私有端口映射的路由器的公网端口,请求端将从所述P2P服务器中获取到服务端对应的路由器的公网端口,并在连接请求模块12中将对等网络连接请求发送至路由器的公网端口。
请求端和服务端将通过P2P服务器进行信息交换,即请求端获取到服务端的资源信息及端口信息,服务端也可获知请求端的资源请求信息、观影信息、端口信息等。请求端和服务端向P2P服务器上报资源请求信息可使用UTP、HTTP、Websocket协议中的任意一种。
连接请求模块12中,请求端将对等网络连接请求发送至服务端对应的路由器的公网端口,路由器在接收到请求端的对等网络连接请求后,会自动根据服务端的私有端口与路由器的公网端口的映射关系将对等网络连接请求转发至服务端。例如,当服务端位于公司的局域网内时,服务端的私有端口指的便是服务端的内网端口,而公网端口则指公司路由器的对外端口。
连接建立模块13中,在服务端接收到请求端发送的对等网络连接请求时, 会根据实际情况进行应答,如果服务端同意建立连接,则会向请求端反馈应答消息,服务端响应所述对等网络请求的应答消息的反馈路径是通过其对应的路由器的公网端口转发至请求端,请求端在收到所述应答消息后,成功建立起与所述服务端的对等网络连接。
本实施例中,针对服务端处于私网中的情况,提供了一种补充连接方式,将请求端的对等网络连接请求经路由器的公网端口转发至服务端的私有端口,从而建立请求端与服务端的对等网络连接。
本申请实施例提供的对等网络连接装置适用于P2P网络系统的请求端,所述请求端和服务端可以是手机、电脑、云视频终端、电视等终端设备,而请求端还可以是HTML5网页端,例如用户通过HTML5网页端进行在线视频点播。由于HTML5网页端运行在浏览器中,其没有访问本地信息的权限,且当其处于私网中时,无法进行与路由器的端口映射,也就无法提供用于接收对等网络连接请求的端口信息,因此,请求端为HTML5网页端时,只能主动向处于P2P网络系统中的其它终端发起对等网络连接请求,而无法接受其它终端发出的对等网络连接请求。当然,本申请实施例提供的请求端也适用于其它类型的请求端,以建立起P2P网络系统中处于私网中的各终端的对等网络连接。
参考图6,本申请实施例提供的对等网络连接装置,还包括:
数据传输模块14,用于根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,接收所述路由器转发的所述服务端发送的资源。
在所述连接建立模块13成功建立起请求端与服务端的对等网络连接之后,请求端和服务端之间可进行资源的共享,请求端接收服务端发送的资源时,通过服务端对应的路由器的公网端口,接收所述路由器转发的所述服务端发送的资源。而且,当服务端的私有端口上开启Websocket协议时,请求端采用Websocket协议与服务端进行通信,在请求端和服务端成功建立起对等网络连接之后,请求端和服务端可进行双向通信,即请求端可接收服务端对应的路由器转发的所述服务端中的资源,请求端也可将其资源经服务端对应的路由器的公网端口转发至服务端。基于此,对于请求端为HTML5网页端的场景下,对等网络连接的建立具有主动和被动之分,而成功建立连接后,请求端和服务端将可实现双向通信,不再有主动和被动之分,这区别于现有的HTTP协议和其它单向通信协议,使P2P网络系统中各终端之间的资源共享更加灵活方便。
当本申请实施例应用于请求端为播放器的场景中时,在执行对等网络连接之前,请求端可先从CDN的节点服务器中下载预定长度的缓冲资源;并在所述缓冲资源下载完成后,将所述缓冲资源之后的资源作为请求资源配置到所述资源请求信息中。
请求端首先向CDN架构中的节点服务器请求一部分缓冲资源,例如请求端观看一部影片时可先供节点服务器中下载10s的缓冲数据,利用10s的缓冲时间,请求端可在缓冲时间内通过P2P方式继续寻找资源,即缓冲资源之后的资源。所述资源请求信息中可将请求端所需的资源进行分段,可根据从P2P服务器中获取的各服务端的资源信息向不同的服务端分别发起对等网络连接请求,分散式获取资源,以提高资源获取的速度。
参考图7,本申请实施例提供一种对等网络连接装置,配置在P2P网络系统的服务端中,包括:
信息生成模块21,用于根据其私有端口映射的路由器的公网端口生成端口信息;
信息上报模块22,用于将资源信息及端口信息上报至P2P服务器;
响应模块23,用于在接收到请求端发送的对等网络连接请求时,将响应所述对等网络连接请求的应答消息通过所述服务端的私有端口映射的所述路由器的公网端口转发至所述请求端,并建立与所述请求端的对等网络连接;
其中,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送,并由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口转发至所述服务端。
本实施例提供的对等网络连接装置适用于P2P网络系统中的服务端,当所述服务端处于私网中时,服务端将其私有端口映射的路由器的公网端口配置到端口信息中,例如,当服务端处于公司局域网中,服务端将其端口5000映射到路由器的端口8000,路由器的端口8000的地址等信息将配置到端口信息。信息上报模块22中,服务端的端口信息和资源信息将通过UTP、HTTP、Websocket协议中的任意一中上报至P2P服务器,请求端将从所述P2P服务器中获取到服务端的端口信息以及资源信息,并根据服务端的资源信息判断是否发送向其发送对等网络 连接请求,如果服务端中缓存有请求端所需的资源,则请求端会根据服务端的端口信息获知服务端对应的路由器的公网端口,请求端的对等网络连接请求将发送至服务端对应的路由器的公网端口,路由器会自动将请求端的对等网络连接请求转发至服务端。
响应模块23接收到路由器转发的请求端的对等网络连接请求后,如果同意建立连接,则将应答消息通过路由器的公网端口转发至请求端,在请求端收到服务端的应答消息后,请求端和服务端可成功建立对等网络连接,并可开始双向传输资源。
所述信息生成模块21中私有端口和路由器的公网端口的映射关系建立可采用多种方式,以下再以一实施例对信息生成模块21进行详细说明。
本实施例中,所述信息生成模块21,用于根据所述路由器为所述服务端的私有端口分配的公网端口生成端口信息。
路由器可根据其各公网端口的闲置情况自动为处于私网中的各终端分配公网端口,并将公网端口与终端的私有端口的映射关系反馈至终端,本实施例中,信息生成模块21根据获知的其私有端口与路由器的公网端口的映射关系,将其私有端口映射的路由器的公网端口的信息生成端口信息。例如,可采用UPNP协议进行网络地址转换,将所述服务端的私有端口的网络地址映射到路由器的公网端口,并将所述路由器的公网端口的网络地址配置到所述端口信息中。
本实施例中,还可由处于私网中的服务端通过UPNP协议请求路由器提供一公网端口以进行服务端私有端口的映射。请求端发送对等连接请求时,将根据所述服务端的端口信息中的路由器的公网端口的网络地址将所述对等网络连接请求发送至所述路由器的公网端口,公网端口则将所述对等网络连接请求转发至服务端,从而所述服务端接收到所述请求端的对等网络连接请求。
本申请实施例针对服务端处于私网中的场景,提供了一种服务端接收请求端的对等网络连接请求,并成功向请求端反馈应答消息以实现建立与请求端的对等网络连接的技术方案,为P2P网络系统中各终端处于不同网络场景中时提供了一种补充的网络连接方式,使得各终端可不受私网的限制,发挥服务端的功能,使得P2P网络系统中的资源共享更加方便,扩大了资源共享的适用范围。
参考图8,本申请实施例提供一种对等网络连接装置,配置在P2P网络系统 的路由器中,包括:
请求接收模块31,用于接收请求端发送的对等网络连接请求,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送的;
转发模块32,用于根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
所述转发模块32,还用于接收所述服务端发送的响应所述请求端发送的对等网络连接请求的应答消息,并将所述应答消息转发至所述请求端,以便于所述请求端在接收到所述路由器转发的所述服务端的应答消息后,建立与所述服务端的对等网络连接。
本实施例申请实施例提供的对等网络连接装置适用于P2P网络系统中的路由器,路由器接收请求端发送的对等网络连接请求,并将接收到的对等网络连接请求转发至服务端。由请求端先根据P2P服务器提供的包含请求端所需资源的服务端的端口信息获取到服务端对应的路由器的公网端口,之后再根据获取到的端口信息将对等网络连接请求发送至路由器的公网端口,路由器在接收到请求端发送的对等网络请求后,根据路由器的公网端口与服务端的私有端口的映射关系,将对等网络连接请求转发至服务端。
服务端在接收到对等网络连接请求后,会发出响应所述对等网络连接请求的应答消息,服务端发出的应答消息将发送至路由器的公网端口,路由器在会自动将服务器发送的应答消息转发至请求端,至此,在路由器的转发帮助下,请求端和服务端成功建立起对等网络连接,并可进行双向的资源共享,请求端与服务端进行资源共享过程中,路由器可依然承担转发的功能,以保证请求端和服务端的顺畅通信。
本申请实施例还提供一种对等网络连接系统,包括请求端、服务端和路由器,其中所述请求端用于根据图1和2所示的对等网络连接方法向服务端发起对等网络连接,所述服务端用于根据图3所示的对等网络连接方法响应所述请求端的对等网络连接请求,所述路由器用于根据图4所示的对等网络连接方法转发所述请求端的对等网络请求及服务端的应答消息。
在本申请另一实施例中,还提供一种电子设备,包括前述图5或图6所示实施例任一实施例所述的对等网络连接装置。
在本申请另一实施例中,还提供一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令可执行上述图1或图2所示实施例所述的任意方法实施例中的对等网络连接方法。
图9是本申请实施例提供的执行图1或图2所示实施例所述的对等网络连接方法的电子设备的硬件结构示意图,如图9所示,该设备包括:
一个或多个处理器910以及存储器920,图9中以一个处理器910为例。
执行图1或图2所示实施例所述的对等网络连接方法的设备还可以包括:输入装置930和输出装置940。
处理器910、存储器920、输入装置930和输出装置940可以通过总线或者其他方式连接,图9中以通过总线连接为例。
存储器920作为一种非暂态计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请图1或图2所示实施例所述的对等网络连接方法对应的程序指令/模块(例如,附图5所示的信息获取模块11、连接请求模块12和连接建立模块13)。处理器910通过运行存储在存储器920中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述图1或图2所示实施例所述的方法实施例对等网络连接方法。
存储器920可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据图5或图6所示实施例所述的对等网络连接装置的使用所创建的数据等。此外,存储器920可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器920可选包括相对于处理器910远程设置的存储器,这些远程存储器可以通过网络连接至图5或图6所示实施例所述的对等网络连接装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置930可接收输入的数字或字符信息,以及产生与图5或图6所示实施例所述的对等网络连接装置的用户设置以及功能控制有关的键信号输入。输出 装置940可包括显示屏等显示设备。
所述一个或者多个模块存储在所述存储器920中,当被所述一个或者多个处理器910执行时,执行上述图1或图2所示实施例所述的任意方法实施例中的对等网络连接方法。
上述产品可执行本申请图1或图2所示实施例所提供的方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本申请图1或图2所示实施例所提供的方法。
本申请实施例的电子设备以多种形式存在,包括但不限于:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。
(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、系统总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。
(5)其他具有数据交互功能的电子装置。
在本申请另一实施例中,还提供一种电子设备,包括前述图7所示实施例任一实施例所述的对等网络连接装置。
在本申请另一实施例中,还提供一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令可执行上述图3所示实施例所述的任意方法实施例中的对等网络连接方法。
图10是本申请实施例提供的执行图3所示实施例所述的对等网络连接方法 的电子设备的硬件结构示意图,如图10所示,该设备包括:
一个或多个处理器1010以及存储器1020,图10中以一个处理器1010为例。
执行图3所示实施例所述的对等网络连接方法的设备还可以包括:输入装置1030和输出装置1040。
处理器1010、存储器1020、输入装置1030和输出装置1040可以通过总线或者其他方式连接,图10中以通过总线连接为例。
存储器1020作为一种非暂态计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请图3所示实施例所述的对等网络连接方法对应的程序指令/模块(例如,附图7所示的信息生成模块21、信息上报模块22和响应模块23)。处理器1010通过运行存储在存储器1020中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述图3所示实施例所述的方法实施例对等网络连接方法。
存储器1020可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据图7所示实施例所述的对等网络连接装置的使用所创建的数据等。此外,存储器1020可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器1020可选包括相对于处理器1010远程设置的存储器,这些远程存储器可以通过网络连接至图7所示实施例所述的对等网络连接装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置1030可接收输入的数字或字符信息,以及产生与图7所示实施例所述的对等网络连接装置的用户设置以及功能控制有关的键信号输入。输出装置1040可包括显示屏等显示设备。
所述一个或者多个模块存储在所述存储器1020中,当被所述一个或者多个处理器1010执行时,执行上述图3所示实施例所述的任意方法实施例中的对等网络连接方法。
上述产品可执行本申请图3所示实施例所提供的方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本申请图3所示实施例所提供的方法。
本申请实施例的电子设备以多种形式存在,包括但不限于:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。
(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、系统总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。
(5)其他具有数据交互功能的电子装置。
在本申请另一实施例中,还提供一种电子设备,包括前述图8所示实施例任一实施例所述的对等网络连接装置。
在本申请另一实施例中,还提供一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令可执行上述4所示实施例所述的任意方法实施例中的对等网络连接方法。
图11是本申请实施例提供的执行图4所示实施例所述的对等网络连接方法的电子设备的硬件结构示意图,如图11所示,该设备包括:
一个或多个处理器1110以及存储器1120,图11中以一个处理器1110为例。
执行图4所示实施例所述的对等网络连接方法的设备还可以包括:输入装置1130和输出装置1140。
处理器1110、存储器1120、输入装置1130和输出装置1140可以通过总线或者其他方式连接,图11中以通过总线连接为例。
存储器1120作为一种非暂态计算机可读存储介质,可用于存储非易失性软 件程序、非易失性计算机可执行程序以及模块,如本申请图4所示实施例所述的对等网络连接方法对应的程序指令/模块(例如,附图8所示的请求接收模块31和转发模块32)。处理器1110通过运行存储在存储器1120中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述图4所示实施例所述的方法实施例对等网络连接方法。
存储器1120可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据图8所示实施例所述的对等网络连接装置的使用所创建的数据等。此外,存储器1120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器1120可选包括相对于处理器1110远程设置的存储器,这些远程存储器可以通过网络连接至图8所示实施例所述的对等网络连接装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置1130可接收输入的数字或字符信息,以及产生与图8所示实施例所述的对等网络连接装置的用户设置以及功能控制有关的键信号输入。输出装置1140可包括显示屏等显示设备。
所述一个或者多个模块存储在所述存储器1120中,当被所述一个或者多个处理器1110执行时,执行上述图4所示实施例所述的任意方法实施例中的对等网络连接方法。
上述产品可执行本申请图4所示实施例所提供的方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本申请图4所示实施例所提供的方法。
本申请实施例的电子设备以多种形式存在,包括但不限于:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。
(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、系统总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。
(5)其他具有数据交互功能的电子装置。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (19)

  1. 一种对等网络连接方法,其特征在于,应用于电子设备,包括:
    请求端获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息,所述端口信息包括服务端的私有端口映射的路由器的公网端口;
    所述请求端向所述路由器的公网端口发送对等网络连接请求,由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
    所述请求端在接收到所述路由器转发的所述服务端响应所述对等网络连接请求的应答消息后,建立与所述服务端的对等网络连接。
  2. 根据权利要求1所述的方法,其特征在于,所述建立与所述服务端的对等网络连接之后,进一步包括:
    所述请求端根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,接收所述路由器转发的所述服务端发送的资源。
  3. 一种对等网络连接方法,其特征在于,应用于电子设备,包括:
    服务端根据其私有端口映射的路由器的公网端口生成端口信息;
    所述服务端将资源信息及端口信息上报至P2P服务器;
    所述服务端在接收到请求端发送的对等网络连接请求时,将响应所述对等网络连接请求的应答消息通过所述服务端的私有端口映射的所述路由器的公网端口转发至所述请求端,并建立与所述请求端的对等网络连接;
    其中,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送,并由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口转发至所述服务端。
  4. 根据权利要求3所述的方法,其特征在于,所述服务端根据其私有端口映射的路由器的公网端口生成端口信息,包括:
    所述服务端根据所述路由器为所述服务端的私有端口分配的公网端口生成端口信息。
  5. 一种对等网络连接方法,其特征在于,应用于电子设备,包括:
    路由器接收请求端发送的对等网络连接请求,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送的;
    所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
    所述路由器接收所述服务端发送的响应所述请求端发送的对等网络连接请求的应答消息,并将所述应答消息转发至所述请求端,以便于所述请求端在接收到所述路由器转发的所述服务端的应答消息后,建立与所述服务端的对等网络连接。
  6. 一种对等网络连接装置,其特征在于,包括:
    信息获取模块,用于获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息,所述端口信息包括服务端的私有端口映射的路由器的公网端口;
    连接请求模块,用于向所述路由器的公网端口发送对等网络连接请求,由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
    连接建立模块,用于在接收到所述路由器转发的所述服务端响应所述对等网络连接请求的应答消息后,建立与所述服务端的对等网络连接。
  7. 根据权利要求6所述的装置,其特征在于,还包括:
    数据传输模块,用于根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,接收所述路由器转发的所述服务端发送的资源。
  8. 一种对等网络连接装置,其特征在于,包括:
    信息生成模块,用于根据其私有端口映射的路由器的公网端口生成端口信息;
    信息上报模块,用于将资源信息及端口信息上报至P2P服务器;
    响应模块,用于在接收到请求端发送的对等网络连接请求时,将响应所 述对等网络连接请求的应答消息通过所述服务端的私有端口映射的所述路由器的公网端口转发至所述请求端,并建立与所述请求端的对等网络连接;
    其中,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送,并由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口转发至所述服务端。
  9. 根据权利要求8所述的装置,其特征在于,所述信息生成模块,用于:
    根据所述路由器为所述服务端的私有端口分配的公网端口生成端口信息。
  10. 一种对等网络连接装置,其特征在于,包括:
    请求接收模块,用于接收请求端发送的对等网络连接请求,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送的;
    转发模块,用于根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
    所述转发模块,还用于接收所述服务端发送的响应所述请求端发送的对等网络连接请求的应答消息,并将所述应答消息转发至所述请求端,以便于所述请求端在接收到所述路由器转发的所述服务端的应答消息后,建立与所述服务端的对等网络连接。
  11. 一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求1-2任一所述方法。
  12. 一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求3-4任一所述方法。
  13. 一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机 可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求5所述方法。
  14. 一种电子设备,其特征在于,包括:
    一个或多个处理器;以及,
    与所述一个或多个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述一个或多个处理器执行的指令,所述指令被所述一个或多个处理器执行,以使所述一个或多个处理器能够:
    请求端获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息,所述端口信息包括服务端的私有端口映射的路由器的公网端口;
    所述请求端向所述路由器的公网端口发送对等网络连接请求,由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
    所述请求端在接收到所述路由器转发的所述服务端响应所述对等网络连接请求的应答消息后,建立与所述服务端的对等网络连接。
  15. 一种电子设备,其特征在于,包括:
    一个或多个处理器;以及,
    与所述一个或多个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述一个或多个处理器执行的指令,所述指令被所述一个或多个处理器执行,以使所述一个或多个处理器能够:
    服务端根据其私有端口映射的路由器的公网端口生成端口信息;
    所述服务端将资源信息及端口信息上报至P2P服务器;
    所述服务端在接收到请求端发送的对等网络连接请求时,将响应所述对等网络连接请求的应答消息通过所述服务端的私有端口映射的所述路由器的公网端口转发至所述请求端,并建立与所述请求端的对等网络连接;
    其中,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送,并由所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口 转发至所述服务端。
  16. 一种电子设备,其特征在于,包括:
    一个或多个处理器;以及,
    与所述一个或多个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述一个或多个处理器执行的指令,所述指令被所述一个或多个处理器执行,以使所述一个或多个处理器能够:
    路由器接收请求端发送的对等网络连接请求,所述对等网络连接请求由所述请求端在获取P2P服务器提供的包含所述请求端所需资源的服务端的端口信息后,根据所述端口信息包括的服务端的私有端口映射的路由器的公网端口,向所述路由器的公网端口发送的;
    所述路由器根据所述路由器的公网端口映射的所述服务端的私有端口将所述对等网络连接请求转发至所述服务端;
    所述路由器接收所述服务端发送的响应所述请求端发送的对等网络连接请求的应答消息,并将所述应答消息转发至所述请求端,以便于所述请求端在接收到所述路由器转发的所述服务端的应答消息后,建立与所述服务端的对等网络连接。
  17. 一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求1-2所述的方法。
  18. 一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求3-4所述的方法。
  19. 一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求5所述的方法。
PCT/CN2016/096010 2015-12-29 2016-08-19 一种对等网络连接方法及装置 WO2017113816A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201511020640.X 2015-12-29
CN201511020640.XA CN105897853A (zh) 2015-12-29 2015-12-29 一种对等网络连接方法及装置

Publications (1)

Publication Number Publication Date
WO2017113816A1 true WO2017113816A1 (zh) 2017-07-06

Family

ID=57002268

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/096010 WO2017113816A1 (zh) 2015-12-29 2016-08-19 一种对等网络连接方法及装置

Country Status (2)

Country Link
CN (1) CN105897853A (zh)
WO (1) WO2017113816A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112019625A (zh) * 2020-08-31 2020-12-01 重庆紫光华山智安科技有限公司 基于websocket消息推送方法、系统、设备及介质

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106791968B (zh) * 2016-11-15 2019-11-05 武汉斗鱼网络科技有限公司 一种数据下载方法和装置
CN109936602B (zh) * 2017-12-18 2022-03-11 本无链科技(深圳)有限公司 一种基于实时推送的p2p网络系统
CN109819336B (zh) * 2019-01-31 2020-12-04 湖南快乐阳光互动娱乐传媒有限公司 一种基于播放缓存大小分片下载的方法及系统
CN113364865B (zh) * 2021-06-03 2023-04-07 湖南快乐阳光互动娱乐传媒有限公司 资源的获取方法、装置、可读介质以及设备

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101699801A (zh) * 2009-10-30 2010-04-28 孙喜明 一种数据传输方法及传输数据的虚拟对等网络系统
CN102055816A (zh) * 2010-12-28 2011-05-11 华为技术有限公司 一种通信方法、业务服务器、中间设备、终端及通信系统
WO2012103938A1 (en) * 2011-02-01 2012-08-09 Telefonaktiebolaget L M Ericsson (Publ) Routing traffic towards a mobile node

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101369959A (zh) * 2007-08-14 2009-02-18 中兴通讯股份有限公司 一种支持点对点业务的网络地址转换穿越方法
CN101252605A (zh) * 2008-04-03 2008-08-27 杭州华三通信技术有限公司 穿越网络地址转换设备的多媒体通信方法、系统及装置
CN101355568B (zh) * 2008-09-03 2011-07-13 中兴通讯股份有限公司 一种静态pat支持绑定路由器接口的方法及系统
US8902743B2 (en) * 2010-06-28 2014-12-02 Microsoft Corporation Distributed and scalable network address translation
CN104426726A (zh) * 2013-09-11 2015-03-18 郑州朗鑫智能电子科技有限公司 一种保护用户隐私和信息安全的智能家居系统

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101699801A (zh) * 2009-10-30 2010-04-28 孙喜明 一种数据传输方法及传输数据的虚拟对等网络系统
CN102055816A (zh) * 2010-12-28 2011-05-11 华为技术有限公司 一种通信方法、业务服务器、中间设备、终端及通信系统
WO2012103938A1 (en) * 2011-02-01 2012-08-09 Telefonaktiebolaget L M Ericsson (Publ) Routing traffic towards a mobile node

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112019625A (zh) * 2020-08-31 2020-12-01 重庆紫光华山智安科技有限公司 基于websocket消息推送方法、系统、设备及介质
CN112019625B (zh) * 2020-08-31 2023-01-31 重庆紫光华山智安科技有限公司 基于websocket消息推送方法、系统、设备及介质

Also Published As

Publication number Publication date
CN105897853A (zh) 2016-08-24

Similar Documents

Publication Publication Date Title
US20170155928A1 (en) Method, Device and System for Playing Live Video
US9467650B2 (en) Method and apparatus for transmitting media stream in video conference
WO2017113816A1 (zh) 一种对等网络连接方法及装置
US20170155695A1 (en) Method, device and system for uploading live video
US11659216B2 (en) Synchronizing and dynamic chaining of a transport layer network service for live content broadcasting
US9806943B2 (en) Enabling planned upgrade/downgrade of network devices without impacting network sessions
US10887359B2 (en) Parallel peer to peer connection establishment in webRTC conferencing
CN108259542B (zh) 资源的传输方法和装置
WO2017107542A1 (zh) 视频节目获取方法、设备及系统
WO2017185697A1 (zh) 一种带宽共享方法及装置
US11108840B2 (en) Transport layer network service for live content broadcasting
RU2011128874A (ru) Архитектура системы обслуживания политик для сеансов, создаваемых с использованием stun
KR20150013860A (ko) 클라이언트 없는 클라우드 컴퓨팅
US20170163706A1 (en) Method, electronic device and system for controlling pull stream
US11240335B2 (en) System and methods thereof for delivery of popular content using a multimedia broadcast multicast service
US11671487B1 (en) Port prediction for peer-to-peer communications
US20150271273A1 (en) System for Using a Device as a Side Car
WO2017107795A1 (zh) 一种网站访问加速方法及装置
US20170142184A1 (en) Native client multimedia redirection
WO2016095510A1 (zh) 一种路径选择方法、设备及系统
US10129320B2 (en) QoS improvement method, apparatus, and system
US20170171566A1 (en) Method and electronic device for transmitting live broadcast data
US9450913B2 (en) CDNI request routing using flow metadata
WO2016106557A1 (zh) 一种用于视频发送的方法与装置
KR101089510B1 (ko) 데이터 전송 방법, 다운로드 클라이언트의 동작 방법, 그리고 네트워크 서버의 동작 방법

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16880609

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16880609

Country of ref document: EP

Kind code of ref document: A1