A terminal device and a method of selecting a seed terminal in a peer-to-peer network

By enabling terminal devices to autonomously determine whether they are seed terminals, the problem of low efficiency and difficulty in guaranteeing the quality of seed terminal selection in existing technologies is solved, thereby improving the efficiency of P2P data transmission.

CN116800763BActive Publication Date: 2026-06-26JUHAOKAN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JUHAOKAN TECH CO LTD
Filing Date
2022-08-30
Publication Date
2026-06-26

Smart Images

  • Figure CN116800763B_ABST
    Figure CN116800763B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a terminal device and a method for selecting a seed terminal in a peer-to-peer network, and relates to the technical field of peer-to-peer networks. The terminal device comprises a controller configured to: acquire a core parameter from a server of a peer-to-peer (P2P) network through a communicator; determine an initial time for transmitting data to any terminal in the P2P network, a data transmission amount, and a current time; calculate a transmission parameter according to the initial time, the data transmission amount, and the current time; and determine whether the terminal device is a seed terminal according to the transmission parameter and the core parameter. The embodiments of the present disclosure reduce the computing pressure of the server side and improve the efficiency of selecting a seed terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of peer-to-peer network technology, and more particularly to a terminal device and a method for selecting a seed terminal in a peer-to-peer network. Background Technology

[0002] Peer-to-peer (P2P) networking is a distributed application architecture that distributes tasks and workloads among peers. It is a network form or topology of the peer-to-peer computing model at the application layer. P2P involves one server and multiple clients. Each client is both a provider (Server) and a recipient (Client) of resources, services, and content. To ensure efficient flow of resources, services, and content in P2P, existing technologies use a server to select from multiple clients, identifying those with fast data transmission speeds and large data volumes as "seeds." However, the number of clients in P2P is enormous, making selection by a single server inefficient, and the quality of the "seeds" is difficult to guarantee. Summary of the Invention

[0003] To address, or at least partially address, the aforementioned technical problems, this disclosure provides a method for selecting a seed terminal in a terminal device and a peer-to-peer network, which can improve the quality and efficiency of seed terminal selection in a peer-to-peer network.

[0004] To achieve the above objectives, the technical solutions provided by the embodiments of this disclosure are as follows:

[0005] In a first aspect, this disclosure provides a terminal device, the terminal device comprising:

[0006] The controller is configured to obtain core parameters from the peer-to-peer (P2P) server via a communicator. The core parameters include at least one of the following: no-transmission hold duration, transmission volume hold duration, transmission speed hold duration, transmission size threshold, and transmission speed threshold.

[0007] Determine the initial time, data transmission amount, and current time for transmitting data to any terminal in the P2P network;

[0008] Based on the initial time, data transmission volume, and current time, calculate the transmission parameters, which include at least one of the following: data transmission change, first duration, second duration, and transmission speed; wherein, the first duration is the duration between the current time and the time when the data transmission volume last changed; and the second duration is the duration between the current time and the time when the data transmission volume remained unchanged.

[0009] Determine whether the terminal device is a seed terminal based on the transmission parameters and core parameters.

[0010] Secondly, this disclosure provides a method for selecting a seed terminal in a peer-to-peer network, the method comprising:

[0011] The core parameters are obtained from the P2P server of the peer-to-peer network through the communicator. The core parameters include at least one of the following: no transmission hold duration, transmission amount hold duration, transmission speed hold duration, transmission size threshold, and transmission speed threshold.

[0012] Determine the initial time, data transmission amount, and current time for transmitting data to any terminal in the P2P network;

[0013] Based on the initial time, data transmission volume, and current time, calculate the transmission parameters, which include at least one of the following: data transmission change, first duration, second duration, and transmission speed; wherein, the first duration is the duration between the current time and the time when the data transmission volume last changed; and the second duration is the duration between the current time and the time when the data transmission volume remained unchanged.

[0014] Determine whether the terminal device is a seed terminal based on the transmission parameters and core parameters.

[0015] Thirdly, this disclosure provides a computer-readable storage medium, including: storing a computer program on the computer-readable storage medium, wherein when the computer program is executed by a processor, it implements the method for selecting a seed terminal in a peer-to-peer network as described in the second aspect.

[0016] Fourthly, this disclosure provides a computer program product comprising a computer program that, when run on a computer, causes the computer to implement the method for selecting a seed terminal in a peer-to-peer network as described in the second aspect.

[0017] This disclosure provides a method for selecting a seed terminal in a terminal device and a peer-to-peer network. The terminal device controller obtains core parameters from a P2P server via a communicator, then determines the initial time, data transmission volume, and current time for transmitting data to any terminal in the P2P network. Based on these parameters, transmission parameters are calculated, and finally, the terminal device itself is determined to be a seed terminal based on the transmission parameters and the core parameters. This method enables each terminal device in the P2P network to proactively determine whether it is a target terminal, reducing server load, improving selection efficiency, ensuring seed quality, and ultimately enhancing P2P data transmission efficiency. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0019] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic diagram of a peer-to-peer network architecture;

[0021] Figure 2A Schematic diagrams of scenarios provided in some embodiments of this disclosure Figure 1 ;

[0022] Figure 2B Schematic diagram of a scenario from some embodiments provided in this disclosure;

[0023] Figure 3 An exemplary block diagram of the configuration of the control device 100 according to an exemplary embodiment is shown;

[0024] Figure 4 A hardware configuration block diagram of a terminal device 200 according to an exemplary embodiment is shown;

[0025] Figure 5 This is a schematic diagram of the software configuration in a terminal device 200 according to one or more embodiments of the present disclosure;

[0026] Figure 6 This is a flowchart illustrating a method for selecting a terminal in a peer-to-peer network provided in this embodiment of the disclosure. Figure 1 ;

[0027] Figure 7 A schematic diagram illustrating the establishment of a communication connection between terminals provided in an embodiment of this disclosure;

[0028] Figure 8 A schematic diagram of the calculation of data transmission changes provided in the embodiments of this disclosure. Figure 1 ;

[0029] Figure 9 Schematic diagram 2 for calculating changes in data transmission provided in this embodiment of the disclosure;

[0030] Figure 10 This is a schematic diagram of the first duration provided in the embodiments of this disclosure;

[0031] Figure 11 This is a schematic diagram of the second duration provided in the embodiments of this disclosure;

[0032] Figure 12 This is a schematic diagram of a method for selecting a terminal in a peer-to-peer network provided in this embodiment of the disclosure. Detailed Implementation

[0033] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0034] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0035] Currently, peer-to-peer networks consist of a tracker server and numerous terminals. The tracker server stores information such as the IP addresses, routing information, and completion status of terminals providing and receiving resources, services, and content. Each terminal can both provide resources, services, and content and obtain them from other terminals. In related technologies, to ensure efficient flow of resources, services, and content in a peer-to-peer network, the tracker server primarily compares the data transmission parameters reported by each terminal, selecting terminals with fast data transmission speeds and large data volumes as seed terminals. However, since there are numerous terminals in the same peer-to-peer network, relying solely on a single tracker server to select seed terminals is inefficient and makes it difficult to guarantee that the transmission speed and volume of the seed terminals are optimal.

[0036] It should be noted that the seed terminal is a P2P seed known to those skilled in the art. P2P seeds have complete backups of shared files and can efficiently and with high quality provide shared files to other terminals.

[0037] For example, such as Figure 1 As shown, Figure 1This is a schematic diagram of a peer-to-peer network architecture. The diagram includes a tracker server 101, providing terminals A102, A103, and A104, and acquiring terminals B105, B106, and B107. Providing terminals A102, A103, and A104 report their respective data transmission parameters to the tracker server 101. The tracker server 101 then compares these parameters and determines providing terminal A102, which has the fastest transmission speed and largest transmission volume, as the seed terminal. The tracker server 101 then sends the IP address, routing information, and completion status of providing terminal A102 to acquiring terminals B105, B106, and B107. These terminals can establish communication connections with providing terminal A102 based on this information, thus meeting their needs for acquiring resources, services, and content. However, selecting seed terminals in this way requires comparing the provided terminals in pairs, which is inefficient and makes it difficult to guarantee the quality of seed terminals, thus affecting the efficient flow of data in peer-to-peer networks.

[0038] To address the aforementioned issues, this disclosure provides a method for selecting seed terminals in a terminal device and a peer-to-peer network. The terminal device controller obtains core parameters from the P2P server via a communicator, then determines the initial time, data transmission volume, and current time for transmitting data to any terminal in the P2P network. Based on these parameters, transmission parameters are calculated, and further, the terminal device itself is determined to be a seed terminal based on the transmission parameters and the core parameters. This method enables each terminal device in the P2P network to proactively determine whether it is a target terminal, reducing server load, improving selection efficiency, ensuring seed quality, and ultimately enhancing P2P data transmission efficiency.

[0039] Figure 2A Schematic diagrams of scenarios provided in some embodiments of this disclosure Figure 1 The diagram shows server 400, first terminal 201, second terminal 202, and third terminal 203. Server 400 maintains a heartbeat with first terminal 201, second terminal 202, and third terminal 203, establishing communication connections between each terminal based on their address information. Taking first terminal 201 as an example, first terminal 201 obtains core parameters from server 400. These core parameters are used to determine whether a terminal in the peer-to-peer network is a seed terminal. When first terminal 201 transmits data to second terminal 202, the initial time, data transmission volume, and current time of the data transmission are determined. Then, transmission parameters are calculated based on the initial time, data transmission volume, and current time. Based on the transmission parameters and core parameters, it is determined whether first terminal 201 is a seed terminal.

[0040] Figure 2B This is a schematic diagram of a scenario from some embodiments provided in this disclosure. For example... Figure 2B As shown, users can operate terminal device 200 through smart device 300 or control device 100 to obtain seed resources from the peer-to-peer network. Terminal device 200 can be a TV, mobile phone, computer, etc.

[0041] In some embodiments, the control device 100 may be a remote control, and the communication between the remote control and the terminal device 200 may include infrared protocol communication, Bluetooth protocol communication, wireless or other wired methods to control the terminal device 200. Users can input user commands through buttons on the remote control, voice input, control panel input, etc., to control the terminal device 200. In some embodiments, mobile terminals, tablet computers, computers, laptops, and other smart devices may also be used to control the terminal device 200.

[0042] In some embodiments, the smart device 300 can install software applications with the terminal device 200 to connect and communicate via network communication protocols, achieving one-to-one control operations and data communication. Audio and video content displayed on the smart device 300 can also be transmitted to the terminal device 200 for synchronized display. The terminal device 200 also communicates with the server 400 via various communication methods. The terminal device 200 can communicate via a local area network (LAN), wireless local area network (WLAN), and other networks. The server 400 can provide various content and interactive features to the terminal device 200. The terminal device 200 can be a liquid crystal display, an OLED display, or a projection terminal device. In addition to providing broadcast television reception functions, the terminal device 200 can also be equipped with a smart network television function that provides computer support.

[0043] Figure 3 An exemplary block diagram of the configuration of the control device 100 according to an exemplary embodiment is shown. Figure 3 As shown, the control device 100 includes a controller 110, a communication interface 130, a user input / output interface 140, a memory, and a power supply. The control device 100 can receive user input operation commands and convert them into commands that the terminal device 200 can recognize and respond to, acting as an intermediary for interaction between the user and the terminal device 200. The communication interface 130 is used for external communication and includes at least one of a WIFI chip, a Bluetooth module, NFC, or a replacement module. The user input / output interface 140 includes at least one of a microphone, a touchpad, a sensor, a button, or a replacement module.

[0044] Figure 4 A hardware configuration block diagram of a terminal device 200 according to an exemplary embodiment is shown. For example... Figure 4 The terminal device 200 shown includes: a tuner / demodulator 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a memory, a power supply, etc. The controller 250 includes a central processing unit, a video processor, an audio processor, a graphics processor, RAM, ROM, and a first to nth interface for input / output. The display 260 can be at least one of a liquid crystal display, an OLED display, a touch display, and a projection display, and can also be a projection device and a projection screen. The tuner / demodulator 210 receives broadcast television signals via wired or wireless reception, and demodulates audio and video signals, such as EPG data signals, from multiple wireless or wired broadcast television signals. The detector 230 is used to collect signals from the external environment or signals interacting with the external environment. The controller 250 and the tuner / demodulator 210 can be located in different separate devices; that is, the tuner / demodulator 210 can also be an external device of the main device where the controller 250 is located, such as an external set-top box.

[0045] In some embodiments, the terminal device 200 described above is a terminal device with display function, such as a television, mobile phone, computer, learning machine, etc.

[0046] In some embodiments, the controller 250 controls the operation of the terminal device 200 and responds to user operations through various software control programs stored in memory. The controller 250 controls the overall operation of the terminal device 200. The user can input user commands through a graphical user interface (GUI) displayed on the display 260, and the user input interface receives the user input commands through the GUI. Alternatively, the user can input user commands by inputting specific sounds or gestures, and the user input interface receives the user input commands by recognizing the sounds or gestures through sensors.

[0047] The output interface (display 260, and / or audio output interface 270) is configured to output user interaction information;

[0048] Communicator 220 is used to communicate with server 400 or other devices.

[0049] This disclosure provides a terminal device, which includes:

[0050] The controller 250 is configured to: obtain core parameters from the P2P server via a communicator, the core parameters including at least one of the following: no-transmission hold duration, transmission volume hold duration, transmission speed hold duration, transmission size threshold, and transmission speed threshold; determine the initial time, data transmission volume, and current time for transmitting data to any terminal in the P2P network; calculate transmission parameters based on the initial time, data transmission volume, and current time, the transmission parameters including at least one of the following: data transmission volume change, first duration, second duration, and transmission speed; wherein the first duration is the duration between the current time and the time of the last change in data transmission volume; the second duration is the duration between the current time and the time when the data transmission volume remains unchanged; and determine whether the terminal device is a seed terminal based on the transmission parameters and the core parameters.

[0051] The aforementioned terminal devices determine whether they are seed terminals by using the core parameters issued by the server and the transmission parameters calculated during data transmission. This reduces the computational burden on the server and improves the efficiency of selecting seed terminals. In addition, the core parameters are adjustable, allowing for the selection of terminals with fast data transmission speeds and large data transmission volumes that meet the seed terminal standards from multiple terminals in the peer-to-peer network.

[0052] In some embodiments, the transmission parameters include the amount of data transmission change. The controller 250 calculates the transmission parameters based on the initial time, the amount of data transmission, and the current time, and is configured to: calculate the data transmission duration based on the initial time and the current time; and calculate the amount of data transmission change within the data transmission duration based on the amount of data transmission.

[0053] In some embodiments, the transmission parameters include the amount of data transmission change. The controller 250 calculates the transmission parameters based on the initial time, the amount of data transmission, and the current time, and is configured to: calculate the amount of data transmission change within a preset offset time before the current time based on a preset offset time, the current time, and the amount of data transmission.

[0054] In some embodiments, the core parameters further include a transmission size threshold and a transmission quantity holding duration; the transmission parameters further include a first duration; the controller 250, after calculating the data transmission change within the data transmission duration based on the data transmission quantity, or calculating the data transmission change within a preset offset duration before the current time based on a preset offset duration, the current time, and the data transmission quantity, is further configured to: determine a first time when the data transmission change is less than the transmission size threshold, the first time being the time of the last change in the data transmission quantity, and calculate the first duration based on the first time and the current time; determine the terminal device as a seed terminal when the first duration is less than or equal to the transmission quantity holding duration; and determine the terminal device as a seed terminal when the data transmission change is greater than or equal to the transmission size threshold.

[0055] In some embodiments, the core parameters further include: a transmission speed threshold and a transmission quantity holding duration; the transmission parameters further include: a transmission speed and a first duration; the controller 250, after calculating the data transmission change within the data transmission duration based on the data transmission quantity, or calculating the data transmission change within a preset offset duration before the current time based on a preset offset duration, the current time, and the data transmission quantity, is further configured to: calculate the transmission speed based on the data transmission change and the data transmission duration or preset offset duration, when the data transmission change is less than the transmission size threshold; determine the first time and calculate the first duration when the data transmission quantity changes; determine the terminal device as a seed terminal when the first duration is less than or equal to the transmission quantity holding duration; and determine the terminal device as a seed terminal when the transmission speed is greater than or equal to the transmission speed threshold.

[0056] In some embodiments, the core parameters further include: no-transmission hold duration, and the transmission parameters further include: a second duration; the controller 250 is configured to: calculate the data transmission change within the data transmission duration based on the data transmission amount, or calculate the data transmission change within a preset offset duration before the current time based on a preset offset duration, the current time, and the data transmission amount, and then further configure to: determine a second time when the data transmission change is less than a transmission size threshold and the data transmission amount remains unchanged; the second time is the time when the data transmission amount remains unchanged; and calculate the second duration based on the second time and the current time.

[0057] In some embodiments, the controller 250 is configured to determine whether a terminal device is a seed terminal based on transmission parameters and core parameters by: determining whether a second duration is less than a no-transmission hold duration; and determining that the terminal device is a seed terminal if the second duration is less than the no-transmission hold duration.

[0058] In some embodiments, before determining the initial time, data transmission amount, and current time for transmitting data to any terminal in the P2P, the controller 250 is further configured to: obtain the address information of any terminal from the server via a communicator, the address information including the public network interconnection protocol address, the private network interconnection protocol address, and the port; and establish a communication connection between the terminal device and any terminal based on the address information of any terminal, so as to transmit data to any terminal.

[0059] like Figure 5 As shown, Figure 5 This is a schematic diagram of the software configuration in a terminal device 200 according to one or more embodiments of the present disclosure, such as... Figure 5As shown, the system is divided into four layers, from top to bottom: the Applications layer (referred to as the "Application Layer"), the Application Framework layer (referred to as the "Framework Layer"), the Android Runtime and System Library layer (referred to as the "System Runtime Layer"), and the Kernel layer. The Kernel layer contains at least one of the following drivers: audio driver, display driver, Bluetooth driver, camera driver, Wi-Fi driver, USB driver, HDMI driver, sensor driver (such as fingerprint sensor, temperature sensor, pressure sensor, etc.), and power driver. To illustrate this solution in more detail, the following will use an exemplary approach... Figure 6 To explain, it is understandable that Figure 6 The steps involved may include more or fewer steps in actual implementation, and the order of these steps may also be different, depending on whether the method for selecting a seed terminal in a peer-to-peer network provided in the embodiments of this disclosure can be implemented.

[0060] like Figure 6 As shown, Figure 6 This is a flowchart illustrating a method for selecting a terminal in a peer-to-peer network provided in this embodiment of the disclosure. Figure 1 The method includes the following steps S601 to S604:

[0061] S601: Obtain core parameters from the peer-to-peer (P2P) server via a communicator.

[0062] The core parameters include at least one of the following: no-transmission hold duration, transmission volume hold duration, transmission speed hold duration, transmission size threshold, and transmission speed threshold. These core parameters serve as evaluation criteria to determine whether a terminal is a seed terminal. The values ​​of each parameter included in the core parameters are set based on statistical analysis results of actual data transmission parameters in the peer-to-peer network, and this disclosure does not impose any limitations on this.

[0063] The no-transmission hold time refers to the duration during which no data is transmitted. If the duration of no data transmission by a terminal is greater than or equal to the no-transmission hold time, then the terminal is not a seed terminal. This can be understood as the terminal not transmitting data for an extended period of time, thus it cannot be considered a seed terminal. If the duration of no data transmission by a terminal is less than the no-transmission hold time, then the terminal can be identified as a seed terminal.

[0064] The duration of data transmission retention refers to the time during which the data transmission volume remains at a certain value. If the data transmission volume of a terminal remains at a certain value for a long period of time with little change, then the terminal is determined not to be a seed terminal.

[0065] The transmission speed maintenance duration refers to the duration during which the data transmission speed remains at a certain value. If a terminal maintains a data transmission speed below the transmission speed threshold for an extended period, then the terminal is determined not to be a seed terminal.

[0066] The transmission size threshold refers to the lower limit that a terminal, acting as a seed terminal, should achieve in terms of data transmission volume. The transmission size threshold includes a first transmission size threshold and a second transmission size threshold. The first transmission size threshold can be set to 0 to filter out terminals with no data transmission. The second transmission size threshold can be set based on historical statistical analysis results to filter out terminals with low data transmission volumes.

[0067] The transmission speed threshold refers to the lower limit that a terminal, as a seed terminal, should achieve in terms of transmission speed.

[0068] On the server side, an interface for sending core parameters is provided. The terminal periodically retrieves the core parameters using this interface.

[0069] In some embodiments, heartbeat data is transmitted between the terminal and the server so that the server can record the terminal's status information for appropriate maintenance. Each terminal in the peer-to-peer network sends its address information to the server, which shares this address information across the network, enabling the terminal to establish communication connections with other terminals in the network, achieving P2P hole punching, and thus enabling point-to-point data transmission between terminals.

[0070] S602. Determine the initial time, data transmission amount, and current time for transmitting data to any terminal in the P2P network.

[0071] In some embodiments, before a terminal transmits data to any terminal in a P2P network, a communication connection needs to be established between the terminal and any terminal through a server. This disclosure provides an implementation method where the terminal obtains the address information of any terminal from the server via a communicator. The address information includes a public network access protocol address, a private network access protocol address, and a port. The terminal establishes a communication connection with any terminal device based on this address information.

[0072] For example, such as Figure 7 As shown, Figure 7This diagram illustrates the establishment of a communication connection between terminals according to an embodiment of the present disclosure. The diagram shows a server 400, a first terminal 201, a second terminal 202, and a third terminal 203. Taking the first terminal 201 as an example, the first terminal 201 obtains the address information of the second terminal 202 and the third terminal 203 from the server 400. Then, the first terminal 201 establishes communication connections with the second terminal 202 and the third terminal 203 respectively based on this address information, thus realizing P2P hole punching. The second terminal 202 and the third terminal 203 can also obtain the address information of other terminals besides themselves from the server 400 and establish communication connections, which will not be elaborated upon in this disclosure.

[0073] After establishing a communication connection with any other terminal in the peer-to-peer network, the terminal transmits data to any terminal, determining the initial time of data transmission, the amount of data transmitted, and the current time.

[0074] S603. Calculate the transmission parameters based on the initial time, the amount of data transmitted, and the current time.

[0075] The transmission parameters include at least one of the following: data transmission change, first duration, second duration, and transmission speed; wherein, the first duration is the duration between the current moment and the moment when the data transmission amount last changed; and the second duration is the duration between the current moment and the moment when the data transmission amount remained unchanged.

[0076] S604. Determine whether the terminal device is a seed terminal based on the transmission parameters and core parameters.

[0077] After calculating the transmission parameters, each transmission parameter is compared with the corresponding core parameters to determine whether the terminal device is a seed terminal.

[0078] The following will explain the process of determining whether a terminal device is a seed terminal based on different transmission parameters:

[0079] (1) Transmission parameters include data transmission changes.

[0080] In some embodiments, the transmission parameters include the amount of data transmission change. First, the data transmission duration is calculated based on the initial time and the current time, and then the amount of data transmission change within the data transmission duration is calculated based on the amount of data transmission.

[0081] like Figure 8 As shown, Figure 8 A schematic diagram of the calculation of data transmission changes provided in the embodiments of this disclosure. Figure 1After determining the initial time t0, the data transmission amount s, and the current time t, the data transmission duration T = t - t0 is calculated based on the initial time t0 and the current time t. Then, the change in data transmission amount is calculated. The data transmission amount corresponding to the initial time t0 is 0, and the data transmission amount corresponding to the current time t is s. Therefore, the change in data transmission amount Δs = s.

[0082] Furthermore, using the first transmission size threshold, it is determined whether the transmission change of the terminal is 0. If the transmission change is equal to the first transmission size threshold, it indicates that the transmission change is zero, meaning that the terminal has not transmitted data during the data transmission duration from the initial moment of data transmission to the current moment, thus determining that the terminal is not a seed terminal. In addition, if the transmission change is equal to the first transmission size threshold, the duration of no data transmission can also be calculated. For specific implementation methods, please refer to the implementation method in "(4) Transmission parameters include transmission change and second duration" below, which will not be repeated here.

[0083] If the change in data transmission is not equal to the first transmission size threshold, the change in data transmission is compared with the second transmission size threshold. If the change in data transmission is greater than or equal to the second transmission size threshold, it means that the change in data transmission has reached the data change corresponding to the seed terminal within the data transmission duration from the initial moment of data transmission to the current moment, and the terminal is determined to be the seed terminal.

[0084] If the change in data transmission is less than the second transmission size threshold, the first duration is further calculated to determine whether the terminal is a seed terminal. For specific implementation methods, refer to (2) for the implementation methods including the change in data transmission and the first duration, which will not be elaborated here.

[0085] In other embodiments, to obtain more accurate data transmission parameters, this disclosure provides an implementation method in which the terminal records the data transmission amount at all times, obtains a preset offset duration, and determines the data transmission change amount within the preset offset duration before the current time based on the preset offset duration, the current time, and the data transmission amount, wherein the preset offset duration is a pre-set duration.

[0086] For example, such as Figure 9 As shown, Figure 9 The second schematic diagram for calculating the change in data transmission provided in this embodiment of the present disclosure shows that the terminal determines and records the amount of data transmission once per second. Based on the preset offset duration Δt and the current time t, the time corresponding to the preset offset duration Δt before the current time t is determined to be t1. The data transmission amount corresponding to t1 is found to be s1. Based on the data transmission amount corresponding to the current time s, the change in data transmission amount Δs = s - s1 within the preset offset duration Δt before the current time t is calculated.

[0087] Furthermore, using the first transmission size threshold, it is determined whether the change in data transmission within the preset offset time period before the current moment is zero. If the change in data transmission equals the first transmission size threshold, it indicates that the terminal did not transmit data within the preset offset time period before the current moment, and thus the terminal is determined not to be a seed terminal. In addition, if the change in data transmission equals the first transmission size threshold, the duration of no data transmission can also be calculated. For specific implementation methods, please refer to the implementation method in "(4) Transmission parameters include data transmission change and second duration" below, which will not be repeated here.

[0088] If the change in data transmission is not equal to the first transmission size threshold, the change in data transmission is compared with the second transmission size threshold. If the change in data transmission is greater than or equal to the second transmission size threshold, it means that within the preset offset time before the current moment, the change in data transmission has reached the amount of data change that the seed terminal should have, and then the terminal is determined to be the seed terminal.

[0089] If the change in data transmission is less than the transmission size threshold, the first duration is further calculated to determine whether the terminal is a seed terminal. For specific implementation methods, refer to (2) for the implementation methods including the change in data transmission and the first duration, which will not be elaborated here.

[0090] (2) Transmission parameters include data transmission change amount and first duration.

[0091] The first duration is the time interval between the current moment and the moment of the last change in data transmission volume. Since the terminal records the data transmission volume at any given moment, among multiple change moments, the last change moment is the one most recent to the current moment, and is denoted as the first moment.

[0092] For example, such as Figure 10 As shown, Figure 10 This is a schematic diagram of the first duration provided in this embodiment of the disclosure. The terminal determines and records the data transmission amount once per second. Starting from the current time t, it queries the data transmission amount of a previous time that is the same as the data transmission amount of the current time. The query finds the most recent change time with the current time t as t2, so the first time is t2.

[0093] If the change in data transmission is less than the second transmission size threshold, the first moment is determined, and then the first duration is calculated based on the first moment and the current moment to obtain the duration between the current moment and the moment when the data transmission amount last changed. Furthermore, the first duration is compared with the transmission amount retention duration in the core parameters.

[0094] If the first duration is greater than or equal to the duration of data transmission, it indicates that the terminal's data transmission volume changes relatively little over a long period, and it can be determined that the terminal is not a seed terminal.

[0095] If the first duration is less than the transmission hold duration, other transmission parameters are further calculated to determine whether the terminal is a seed terminal.

[0096] (3) Transmission parameters include data transmission change, transmission speed, and first duration.

[0097] Even when the change in data transmission amount is not equal to the first transmission size threshold, the transmission speed can still be calculated. First, the transmission speed is calculated based on the change in data transmission amount and the data transmission duration or a preset offset duration. Then, the average data transmission speed of the terminal from the initial moment of data transmission to the current moment is calculated based on the change in data transmission amount and the data transmission duration; alternatively, the data transmission speed of the terminal within the preset offset duration before the current moment is calculated based on the change in data transmission amount and the preset offset duration.

[0098] Following the previous example, given a data transmission duration T from the initial time t0 to the current time t, and a data transmission change of Δs = s, the transmission speed v1 can be calculated based on the data transmission duration T and the data transmission change Δs.

[0099]

[0100] If the data transmission change Δs = s - s1 within a predetermined offset time Δt, then the transmission speed v2 can be calculated.

[0101]

[0102] Furthermore, the calculated transmission speed is compared with the transmission speed threshold in the core parameters.

[0103] If the transmission speed is greater than or equal to the transmission speed threshold, it means that although the amount of data transmission change is less than the transmission size threshold, the transmission speed is large enough to meet the seed terminal standard, and the terminal is then designated as the seed terminal.

[0104] If the transmission speed is less than the transmission speed threshold, it indicates that the data transmission volume is small and the transmission speed does not meet the seed terminal's standard, requiring further assessment of whether the terminal maintains low-speed transmission for an extended period. First, determine the first moment, which is the moment of the last change in data transmission volume, and calculate the first duration based on the first moment and the current moment. Then, compare the first duration with the duration of the transmission volume maintenance.

[0105] If the first duration is less than or equal to the transmission hold duration, it indicates that the terminal is in a short-term low-speed transmission state and can be identified as a seed terminal.

[0106] If the first duration is longer than the transmission hold duration, it means that the terminal maintains low-speed transmission for a long time, which does not meet the conditions for being a seed terminal. Therefore, the terminal is determined not to be a seed terminal.

[0107] (4) Transmission parameters include data transmission change amount and second duration.

[0108] The second duration is the duration between the current moment and the moment when the data transmission volume remains constant. If the data transmission volume at a certain moment is the same as the data transmission volume at the current moment, then that moment is determined to be the moment when the data volume remains constant, and is denoted as the second moment.

[0109] For example, such as Figure 11 As shown, Figure 11 This is a schematic diagram of the second duration provided in this embodiment of the present disclosure. The terminal determines and records the data transmission amount once per second. Starting from the current time t, it queries the data transmission amount of a previous time that is the same as the current time. The query finds that the time when the data transmission amount is unchanged is t3, and then determines the second time as t3.

[0110] When the change in data transmission is equal to the first transmission size threshold, the terminal records the amount of data transmission at all times, determines the second time that is furthest from the current time, and then calculates the second duration based on the second time. Furthermore, it is determined whether the second duration is less than the no-transmission hold-up duration in the core parameters.

[0111] If the second duration is greater than or equal to the no-transmission hold duration, it indicates that the terminal is in a state of no data transmission for a long time and does not meet the conditions to become a seed terminal.

[0112] If the second duration is less than the no-transmission hold duration, it indicates that the terminal is in a state of no data transmission for a short period of time, and the terminal can be identified as a seed terminal.

[0113] After a terminal is identified as a seed terminal, its transmission parameters are uploaded to the server. The server then performs statistical analysis based on the transmission parameters of each terminal, calculates the sharing rate, adjusts the core parameters based on the sharing rate, and distributes them to the peer network for the next selection of seed terminals, thereby further improving the quality of seed terminals.

[0114] Furthermore, after identifying a terminal as a seed terminal through transmission parameters and core parameters, a notification message is sent to the server to inform the server that the terminal has automatically determined itself as a seed terminal based on the core parameters, thereby facilitating efficient and high-quality data transmission in the peer-to-peer network. After a terminal is identified as a seed terminal, its transmission parameters can be sent to the server. The server can then perform statistical analysis based on these parameters and further adjust the core parameters, thereby improving the quality of the seed terminal and increasing the efficiency of data transmission in the peer-to-peer network.

[0115] Additionally, if it is determined that the terminal is not a seed terminal, the system can wait for the terminal to complete data transmission with any other terminal, and then the terminal will become idle and no longer provide seed files to any other terminal. If a terminal in an idle state has no data transmission for an extended period, the communication connection between that terminal and any other terminal will be disconnected. This reduces the server load while ensuring complete data transmission. Alternatively, if it is determined that the terminal is not a seed terminal, the communication connection between the terminal and any other terminal can be directly disconnected, and the terminal will no longer transmit data to other terminals. This reduces the resources consumed by the server in maintaining the terminal as a backup seed terminal, thus reducing the server load.

[0116] In summary, this disclosure provides a method for selecting seed terminals in a peer-to-peer network. The method involves a terminal obtaining core parameters from a P2P server via a communicator, determining the initial time, data transmission volume, and current time for transmitting data to any terminal in the P2P network, calculating transmission parameters based on these parameters, and further determining whether the terminal itself is a seed terminal based on the transmission parameters and core parameters. This enables each terminal in the P2P network to proactively determine whether it is a target terminal, reducing server load, improving selection efficiency, ensuring seed quality, and ultimately enhancing P2P data transmission efficiency.

[0117] like Figure 12 As shown, Figure 12 This is a second flowchart illustrating a method for selecting a terminal in a peer-to-peer network according to an embodiment of this disclosure. The method includes the following steps S1201 to S1208:

[0118] S1201. Obtain core parameters from the P2P server via a communicator.

[0119] S1202. Determine the initial time, data transmission amount, and current time for transmitting data to any terminal in the P2P network.

[0120] Optionally, before executing step S1202, the terminal obtains the address information of any terminal in the peer-to-peer network from the server, establishes a communication connection with any terminal based on the address information, and then performs data transmission.

[0121] Perform step S1203a or S1203b.

[0122] S1203a Calculate the data transmission duration based on the initial time and the current time.

[0123] S1203b, Get the preset offset duration.

[0124] S1204. Calculate the change in data transmission.

[0125] Optionally, after executing step S1203a, the change in data transmission from the initial moment to the current moment is calculated based on the data transmission duration and data transmission amount.

[0126] Optionally, after executing step S1203b, the change in data transmission within the preset offset time before the current time is calculated based on the current time, the preset offset time, and the data transmission amount.

[0127] S1205. Determine whether the change in data transmission is equal to the first transmission size threshold.

[0128] The first transmission threshold is set to 0.

[0129] If the change in data transmission within the data transmission duration is not equal to the first transmission threshold, it indicates that there is data transmission between the terminal device and any terminal from the initial time to the current time. Execute step S1206a, or execute S1206b.

[0130] If the change in data transmission within the data transmission duration is equal to the first transmission threshold, it means that from the initial moment to the current moment, the terminal device has not transmitted data to any terminal, and step S1206c is executed.

[0131] S1206a. Determine whether the change in data transmission is less than the second transmission size threshold.

[0132] If the change in data transmission is less than the second transmission size threshold, then proceed to step S1207a.

[0133] If the change in data transmission is greater than or equal to the second transmission size threshold, it means that the data transmission volume between the terminal and any other terminal has reached the standard to become a seed terminal, and the terminal is determined to be a seed terminal.

[0134] S1207. Calculate the first duration and determine whether the first duration is less than the transmission volume hold duration.

[0135] If the first duration is greater than or equal to the transmission hold duration, it indicates that the terminal is in a state of transmitting a small amount of data for a long time, and then step S1208 is executed.

[0136] If the first duration is less than the transmission hold duration, it means that the terminal transmits a small amount of data in a short period of time and can be used as a seed terminal.

[0137] S1206b Calculate the transmission speed and determine whether the transmission speed is greater than or equal to the transmission speed threshold.

[0138] Optionally, the transmission speed from the current initial moment to the current moment can be calculated based on the change in data transmission and the duration of data transmission.

[0139] Optionally, the transmission speed within the preset offset time period before the current moment can be calculated based on the change in data transmission and the preset offset time period.

[0140] If the transmission speed is greater than or equal to the transmission speed threshold, it means that the terminal meets the data transmission speed condition of the seed terminal, and the terminal can be determined to be a seed terminal.

[0141] If the transmission speed is less than the transmission speed threshold, it means that the terminal's data transmission speed does not meet the requirements to become a seed terminal, and then step S1207 is executed.

[0142] Optionally, if the first duration is greater than or equal to the transmission hold duration, it indicates that the terminal is in a state of long-term low-speed data transmission, and then step S1208 is executed to determine that the terminal is not a seed terminal.

[0143] If the first duration is less than the transmission hold duration, it means that the terminal transmits data at a low speed for a short period of time and can be used as a seed terminal.

[0144] S1206c Calculate the second duration and determine whether the second duration is less than the no-transmission hold duration.

[0145] If the second duration is greater than or equal to the no-transmission hold duration, it indicates that the terminal is in a state of no data transmission for a long time, and then step S1208 is executed.

[0146] If the second duration is less than the no-transmission hold duration, it means that the terminal has no data transmission in a short period of time and can be identified as a seed terminal.

[0147] S1208. It is determined that the terminal is not a seed terminal.

[0148] Optionally, if it is determined that the terminal is not a seed terminal, the communication connection between the terminal and any other terminal is disconnected after the data transmission between the terminal and any other terminal is completed. This is to ensure that the data transmitted between the terminal and any other terminal is complete, and to prevent the terminal from transmitting data to other terminals as a seed terminal, thus affecting the data transmission efficiency of the entire peer-to-peer network.

[0149] Optionally, if it is determined that the terminal is not a seed terminal, the communication connection with any other terminal can be directly disconnected. This reduces the maintenance burden on the server and improves the structural stability of the peer-to-peer network. It should be noted that any terminal can still obtain the necessary seed files from other seed terminals. Therefore, directly disconnecting the communication connection between this terminal and any other terminal will not affect the data acquisition of any terminal, significantly reducing the resources consumed by the server in maintaining this terminal.

[0150] Through the above steps, the terminal device calculates the transmission parameters during data transmission and compares them with the core parameters. The core parameters are the criteria for judging whether a terminal can become a seed terminal. Thus, the terminal actively determines whether it is a seed terminal, eliminating terminals that do not transmit data for a long time, terminals that transmit small amounts of data for a long time, and terminals with slow data transmission speeds for a long time from the many terminals in the peer-to-peer network. This reduces the computing pressure on the server, improves the efficiency of selecting seed terminals in the peer-to-peer network, and ensures the quality of seed terminals, which is conducive to the efficient flow of resources, services, and content in the peer-to-peer network.

[0151] This disclosure provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the method for selecting a seed terminal in a peer-to-peer network described above, and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0152] The computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0153] This disclosure provides a computer program product that includes a computer program that, when run on a computer, enables the computer to implement the method described above for selecting a seed terminal in a peer-to-peer network.

[0154] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the discussion in some embodiments above is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the embodiments and various different variations of the embodiments suitable for specific application considerations.

Claims

1. A terminal device, characterized in that, include: The controller is configured to obtain core parameters from a peer-to-peer (P2P) server via a communicator. The core parameters include at least one of the following: no-transmission hold duration, transmission volume hold duration, transmission speed hold duration, transmission size threshold, and transmission speed threshold. Determine the initial time, data transmission amount, and current time for transmitting data to any terminal in the P2P network; Based on the initial time, the data transmission amount, and the current time, transmission parameters are calculated, and the transmission parameters include at least one of the following: data transmission change amount, first duration, second duration, and transmission speed; wherein, the first duration is the duration between the current time and the time when the data transmission amount last changed; and the second duration is the duration between the current time and the time when the data transmission amount remained unchanged. Determine whether the terminal device is a seed terminal based on the transmission parameters and the core parameters; The transmission parameters include the data transmission change amount, and the core parameters also include the transmission size threshold and the transmission amount holding duration; the controller, in determining whether the terminal device is a seed terminal based on the transmission parameters and the core parameters, includes: If the change in data transmission amount is less than the transmission size threshold, a first moment is determined, which is the moment when the data transmission amount last changed, and a first duration is calculated based on the first moment and the current moment; If the first duration is less than or equal to the transmission volume holding duration, the terminal device is determined to be the seed terminal.

2. The terminal device according to claim 1, characterized in that, The controller, based on the initial time, the data transmission volume, and the current time, calculates transmission parameters and is configured as follows: Calculate the data transmission duration based on the initial time and the current time; Based on the data transmission volume, calculate the change in data transmission within the data transmission duration.

3. The terminal device according to claim 1, characterized in that, The controller, based on the initial time, the data transmission volume, and the current time, calculates transmission parameters and is configured as follows: Based on the preset offset duration, the current time, and the data transmission amount, calculate the change in data transmission within the preset offset duration prior to the current time.

4. The terminal device according to claim 2 or 3, characterized in that, The controller, after calculating the change in data transmission within the data transmission duration based on the data transmission volume, or calculating the change in data transmission within the preset offset duration before the current time based on the preset offset duration, the current time, and the data transmission volume, is further configured to: If the change in data transmission is greater than or equal to the transmission size threshold, the terminal device is determined to be the seed terminal.

5. The terminal device according to claim 2 or 3, characterized in that, The core parameters also include: the transmission speed threshold and the transmission quantity holding duration; the transmission parameters also include: the transmission speed and the first duration. The controller, after calculating the change in data transmission within the data transmission duration based on the data transmission volume, or calculating the change in data transmission within the preset offset duration before the current time based on the preset offset duration, the current time, and the data transmission volume, is further configured to: If the change in data transmission is less than the transmission size threshold, the transmission speed is calculated based on the change in data transmission and the data transmission duration or a preset offset duration. If the transmission speed is less than the transmission speed threshold, a first moment is determined and the first duration is calculated; if the first duration is less than or equal to the transmission volume maintenance duration, the terminal device is determined to be the seed terminal. If the transmission speed is greater than or equal to the transmission speed threshold, the terminal device is determined to be the seed terminal.

6. The terminal device according to claim 2 or 3, characterized in that, The core parameters also include: the no-transmission hold duration, and the transmission parameters also include: the second duration; The controller, after calculating the change in data transmission within the data transmission duration based on the data transmission volume, or calculating the change in data transmission within the preset offset duration before the current time based on the preset offset duration, the current time, and the data transmission volume, is further configured to: If the change in data transmission is less than the transmission size threshold, a second time point is determined, where the data transmission amount remains constant. The second duration is calculated based on the second time point and the current time point.

7. The terminal device according to claim 6, characterized in that, The controller, configured to determine whether the terminal device is a seed terminal based on the transmission parameters and the core parameters, is as follows: Determine whether the second duration is less than the no-transmission hold duration; If the second duration is less than the no-transmission hold duration, the terminal device is determined to be a seed terminal.

8. The terminal device according to claim 1, characterized in that, Before determining the initial time, data transmission amount, and current time for transmitting data to any terminal in the P2P network, the controller is further configured to: The address information of any terminal is obtained from the server through the communicator. The address information includes the public network interconnection protocol address, the intranet interconnection protocol address, and the port. Based on the address information of any of the terminals, a communication connection is established between the terminal device and any of the terminals to transmit data to any of the terminals.

9. A method for selecting a seed terminal in a peer-to-peer network, characterized in that, include: The core parameters are obtained from the P2P server of the peer-to-peer network through the communicator. The core parameters include at least one of the following: no transmission hold duration, transmission amount hold duration, transmission speed hold duration, transmission size threshold, and transmission speed threshold. Determine the initial time, data transmission amount, and current time for transmitting data to any terminal in the P2P network; Based on the initial time, the data transmission amount, and the current time, transmission parameters are calculated, and the transmission parameters include at least one of the following: data transmission change amount, first duration, second duration, and transmission speed; wherein, the first duration is the duration between the current time and the time when the data transmission amount last changed; and the second duration is the duration between the current time and the time when the data transmission amount remained unchanged. Determine whether the terminal device is a seed terminal based on the transmission parameters and the core parameters; The transmission parameters include the amount of data transmission change, and the core parameters also include the transmission size threshold and the duration of the transmission amount retention. The step of determining whether the terminal device is a seed terminal based on the transmission parameters and the core parameters includes: when the data transmission change is less than the transmission size threshold, determining a first moment, where the first moment is the moment when the data transmission amount last changes, and calculating a first duration based on the first moment and the current moment; and determining the terminal device as the seed terminal when the first duration is less than or equal to the transmission amount maintenance duration.

10. The method according to claim 9, characterized in that, The step of calculating transmission parameters based on the initial time, the data transmission amount, and the current time includes: Calculate the data transmission duration based on the initial time and the current time; Based on the data transmission volume, calculate the change in data transmission within the data transmission duration.