CN110932980B - Communication method, terminal, and computer-readable storage medium - Google Patents

Communication method, terminal, and computer-readable storage medium Download PDF

Info

Publication number
CN110932980B
CN110932980B CN201911181464.6A CN201911181464A CN110932980B CN 110932980 B CN110932980 B CN 110932980B CN 201911181464 A CN201911181464 A CN 201911181464A CN 110932980 B CN110932980 B CN 110932980B
Authority
CN
China
Prior art keywords
addresses
address
nodes
sending
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911181464.6A
Other languages
Chinese (zh)
Other versions
CN110932980A (en
Inventor
张朝勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cloudminds Robotics Co Ltd
Original Assignee
Cloudminds Shanghai Robotics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Cloudminds Shanghai Robotics Co Ltd filed Critical Cloudminds Shanghai Robotics Co Ltd
Priority to CN201911181464.6A priority Critical patent/CN110932980B/en
Publication of CN110932980A publication Critical patent/CN110932980A/en
Application granted granted Critical
Publication of CN110932980B publication Critical patent/CN110932980B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/44Distributed routing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Small-Scale Networks (AREA)

Abstract

The embodiment of the invention relates to the technical field of communication, and discloses a communication method, which comprises the following steps: acquiring at least M addresses, wherein M is ≧ 2; respectively and simultaneously searching nodes which can communicate with each address in the M addresses within a first preset time length; and selecting an address with the node number larger than a first threshold value from the M addresses as a first sending address, sending first to-be-transmitted information to a plurality of first nodes which can be communicated with the first sending address, and acquiring first return information of the plurality of first nodes returning to the first sending address. The invention also provides a terminal and a computer readable storage medium. The communication method, the terminal and the computer readable storage medium provided by the invention can improve the message transmission efficiency on the premise of ensuring the message transmission reliability.

Description

Communication method, terminal, and computer-readable storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a communication method, a terminal, and a computer-readable storage medium.
Background
In the chat software, a centralized server is generally used to provide background services, but some scenarios may favor using the DHT network for communication for security. The DHT is called a Distributed Hash Table (Distributed Hash Table) and is a Distributed storage method. That is, each client is responsible for a small range of routes and for storing a small portion of data, without the need for a server, thereby enabling addressing and storage of the entire DHT network. In the prior art, there are two steps for sending messages in a network environment of DHT, which are: 1) searching a batch of nodes which are relatively distributed and online and correspond to the addresses; 2) corresponding content is sent to the batch of nodes.
The inventor finds that at least the following problems exist in the prior art: in order to ensure the reliability of message transmission, it usually takes a long time to find the node corresponding to the address, resulting in inefficient message transmission.
Disclosure of Invention
An object of embodiments of the present invention is to provide a communication method, a terminal, and a computer-readable storage medium, which can improve message transmission efficiency on the premise of ensuring reliability of message transmission.
To solve the above technical problem, an embodiment of the present invention provides a communication method, including: acquiring at least M addresses, wherein M is ≧ 2; respectively and simultaneously searching nodes which can communicate with each address in the M addresses within a first preset time length; and selecting an address with the node number larger than a first threshold value from the M addresses as a first sending address, sending first to-be-transmitted information to a plurality of first nodes which can be communicated with the first sending address, and acquiring first return information of the plurality of first nodes returning to the first sending address.
An embodiment of the present invention further provides a terminal, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the communication method of any one of claims 1 to 7.
Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which when executed by a processor implements the above-described communication method.
Compared with the prior art, the embodiment of the invention searches the nodes which can be communicated with each address in the M addresses respectively and simultaneously in the first preset time length, and can be communicated with the M addresses, so that the number of the nodes corresponding to at least one address in the M addresses can be ensured to meet the requirement, the address with the number of the nodes larger than the first threshold value can be selected from the M addresses to serve as the first sending address, namely, the number of the nodes which can be communicated and correspond to the first sending address can meet the requirement, the reliability of message sending is ensured, the first preset time length does not need to be set to be overlarge to ensure that the number of the nodes is large enough, meanwhile, the nodes which can be communicated and correspond to each address in the M addresses are searched simultaneously, namely, the searched nodes are more and faster by utilizing the concurrent processing of the program, therefore, the searching of the communicable nodes corresponding to the M addresses can be completed only by spending the first preset time, the searching time of the nodes corresponding to the addresses is shortened, and the message transmission efficiency is improved.
In addition, after searching for nodes communicable with each address of the M addresses respectively and simultaneously within the first preset time period, the method further includes: associating and storing each address in the M addresses with the searched nodes which can communicate with the address; after the first reply information returned by the plurality of first nodes is obtained, the method further comprises: selecting an address with the number of other nodes larger than a first threshold value from the M addresses as a second sending address, and acquiring a plurality of second nodes associated with the second sending address; and sending second information to be transmitted to the plurality of second nodes, and acquiring second reply information of the second sending address returned by the plurality of second nodes. Each address in the M addresses is respectively associated and stored with the searched node which can be communicated with the address, so that the address and the associated node can be selected from the current M addresses during subsequent message sending, the node is not required to be searched every time the message is sent, and the message transmission efficiency is further improved.
In addition, after searching for nodes communicable with each address of the M addresses respectively and simultaneously within the first preset time period, the method further includes: marking the addresses of which the number of nodes is greater than a first threshold value in the M addresses; respectively associating and storing the marked address in the M addresses with the searched nodes which can be communicated with the M addresses; the selecting, as the first sending address, an address whose node number is greater than a first threshold from the M addresses specifically includes: selecting an address from the tagged addresses as the first sending address.
In addition, after the obtaining of the first reply information returned by the plurality of first nodes, the method further includes: selecting another address from the marked addresses as a second sending address, and acquiring a plurality of second nodes associated with the second sending address; and sending second information to be transmitted to the plurality of second nodes, and acquiring second reply information of the second sending address returned by the plurality of second nodes. By marking the addresses with the number of nodes larger than the first threshold value in the M addresses and respectively associating and storing the marked addresses in the M addresses with the searched nodes capable of communicating with the addresses, when the second information to be transmitted is transmitted, another address can be directly selected from the marked addresses as a second transmission address, the nodes do not need to be searched every time the information is transmitted, and the efficiency of information transmission is further improved.
In addition, after the second transmission address is selected, the method further includes: acquiring the number of addresses of which the number of remaining nodes in the M addresses is greater than a first threshold value; if the number of the addresses is smaller than a second threshold value, nodes which can be communicated with each address in P addresses are searched respectively and simultaneously within a second preset time length, wherein the P addresses are not overlapped with the M addresses. If the number of the addresses is smaller than the second threshold, nodes which can communicate with each address in the P addresses are searched respectively and simultaneously within a second preset time period, namely, when the number of the remaining available addresses is insufficient, the nodes which can communicate with the addresses of the next batch are searched in advance, so that the searched addresses can be directly obtained when the message is sent, the time for waiting the addresses to search the nodes which can communicate is saved, and the message sending efficiency is improved.
In addition, the acquiring of at least M addresses specifically includes: at least the M addresses and the P addresses are obtained.
In addition, the acquiring of at least M addresses specifically includes: acquiring the M addresses; before searching for nodes communicable with each address of the P addresses respectively and simultaneously within the second preset time, the method further includes: and acquiring the P addresses, wherein P ≧ 2.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
Fig. 1 is a flowchart of a communication method according to a first embodiment of the present invention;
fig. 2 is a flowchart of a communication method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a communication method according to a third embodiment of the present invention;
fig. 4 is a flowchart of a communication method according to a fourth embodiment of the present invention;
fig. 5 is a flowchart of a communication method according to a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a terminal according to a sixth embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.
A first embodiment of the present invention relates to a communication method, as shown in fig. 1, including the steps of:
s11: at least M addresses are acquired.
Specifically, only M addresses may be obtained, or more than M addresses may be obtained, where the specific form of the address is similar to the SHA1 hash value, and may be an integer as long as 160 bits, which is randomly generated, and it is very unlikely that the address has the same address as other nodes.
S12: and respectively and simultaneously searching nodes which can be communicated with each address in the M addresses within a first preset time length.
In this step, the search duration is set to be a first preset duration, nodes which can communicate with each address in the M addresses are searched respectively and simultaneously, the step of searching for the nodes which can communicate with each address is performed simultaneously, and when the search duration reaches the first preset duration, the search for the nodes which can communicate with each address is stopped. The first preset time duration may be set as required, and may be set to a value that does not affect the chat experience much, for example, 5 seconds, and M may be set as experience, as long as it is ensured that when a node communicable with each address of M addresses is searched separately and simultaneously within the first preset time duration, the number of communicable nodes searched by at least one address may meet the requirement of sending the first information to be transmitted and the reply information, for example, M is equal to 20, and at this time, 30% to 50% of the number of communicable nodes searched by an address may generally meet the requirement.
Specifically, "a node communicable with an address" may be understood as: and a node which is close to the address and is online, wherein the distance between the two nodes is not measured by means of physical distance and router hop number, and the distance d is defined as a binary bit-by-bit sum of the ID values of the two nodes, that is, assuming that the IDs of the two nodes are a and b respectively, the following steps are provided: d ═ a XORb. Each node can judge the distance between other nodes and the node according to the distance concept, when the value of d is large, the distance between the nodes is long, and when the value of d is small, the distance between the two nodes is very short. Both "distance" and "distance" are described herein as a logical measure, i.e., the distance is non-directional, i.e., the distance a to b is constant equal to the distance b to a.
In practical applications, the search process of the communicable node corresponding to each address is roughly as follows: a. screening a plurality of nodes closest to the target ID from a k-bucket of the query initiator by the query initiator, and simultaneously sending asynchronous query requests to the nodes; b. after receiving the request, the inquired node finds out a plurality of nodes which are known by the inquired node and are closest to the inquiry target ID from the k-bucket of the inquired node, and returns the nodes to the initiator; c. after receiving the return information, the initiator picks out a plurality of nodes which are not requested from all known nodes which are closer to the target again, and repeats the step 1; d. the steps are repeated continuously until the active nodes which are closer to the target than the k nodes currently known by the inquirer cannot be obtained; e. in the inquiry process, nodes which do not respond in time are immediately eliminated; the querier must ensure that the k most nodes ultimately obtained are all active.
S13: and selecting an address with the node number larger than a first threshold value from the M addresses as a first sending address, sending first to-be-transmitted information to a plurality of first nodes which can be communicated with the first sending address, and acquiring first reply information returned by the first sending address by the plurality of first nodes.
In this step, addresses may be sequentially fetched from M addresses according to a generation sequence of the M addresses, and it may be determined whether the number of nodes that can communicate with the addresses is greater than a first threshold, and the fetched number of nodes that can communicate with the addresses is taken as a first sending address until the number of nodes that can communicate with the addresses is greater than the first threshold, where the first threshold may be set as needed.
It is understood that, when the number of the addresses acquired in step S11 is greater than M, selecting the first sending address may be performed from all the addresses according to the generation sequence of the addresses, where there may be a case where the selected address has not searched for a node that can communicate with the selected address, and at this time, a batch of addresses needs to be loaded (i.e., the selected address has searched for a node that can communicate with the selected address), and the address may be used after the batch of addresses is loaded, and if a subsequent address is loaded, the subsequent address is ready for subsequent use, so that the subsequent use is not affected, and the waiting may not be performed.
After the first sending address is selected, the terminal sends first information to be transmitted to a plurality of first nodes which can be communicated with the first sending address, the first information to be transmitted is sent to a target address through the plurality of first nodes, and first reply information returned by the target terminal returns to the first sending address through an original path of the sending information so as to be received by the terminal.
Compared with the prior art, the embodiment of the invention searches the nodes which can be communicated with each address in the M addresses respectively and simultaneously in the first preset time length, and can be communicated with the M addresses, so that the number of the nodes corresponding to at least one address in the M addresses can be ensured to meet the requirement, the address with the number of the nodes larger than the first threshold value can be selected from the M addresses to serve as the first sending address, namely, the number of the nodes which can be communicated and correspond to the first sending address can meet the requirement, the reliability of message sending is ensured, the first preset time length does not need to be set to be overlarge to ensure that the number of the nodes is large enough, meanwhile, the nodes which can be communicated and correspond to each address in the M addresses are searched simultaneously, namely, the searched nodes are more and faster by utilizing the concurrent processing of the program, therefore, the searching of the communicable nodes corresponding to the M addresses can be completed only by spending the first preset time, the searching time of the nodes corresponding to the addresses is shortened, and the message transmission efficiency is improved.
A second embodiment of the present invention relates to a communication method. The second embodiment is substantially the same as the first embodiment, and mainly differs therefrom in that: in the second embodiment of the present invention, after searching for nodes communicable with each of the M addresses respectively and simultaneously within the first preset time period, the method further includes: associating and storing each address in the M addresses with the searched nodes which can communicate with the address; after the first reply information returned by the plurality of first nodes is obtained, the method further comprises: selecting an address with the number of other nodes larger than a first threshold value from the M addresses as a second sending address, and acquiring a plurality of second nodes associated with the second sending address; and sending second information to be transmitted to the plurality of second nodes, and acquiring second reply information of the second sending address returned by the plurality of second nodes. Each address in the M addresses is respectively associated and stored with the searched node which can be communicated with the address, so that the address and the associated node can be selected from the current M addresses during subsequent message sending, the node is not required to be searched every time the message is sent, and the message transmission efficiency is further improved.
As shown in fig. 2, the communication method in the present embodiment specifically includes the following steps:
s21: at least M addresses are acquired.
S22: and respectively and simultaneously searching nodes which can communicate with each address in the M addresses within a first preset time length.
S23: and associating and storing each address in the M addresses with the searched nodes which can communicate with the address.
Specifically, each address is respectively associated with the searched node capable of communicating with the address and stored, so that the associated node capable of communicating with the address can be found in the process of taking out the address for use subsequently, and because each address in the M addresses is stored, the remaining addresses after the message is sent at this time can be reserved for other messages to be sent subsequently for use.
S24: and selecting an address with the node number larger than a first threshold value from the M addresses as a first sending address, sending first to-be-transmitted information to a plurality of first nodes which can be communicated with the first sending address, and acquiring first reply information returned by the first sending address by the plurality of first nodes.
S25: and selecting an address with the number of other nodes larger than the first threshold value from the M addresses as a second sending address, acquiring a plurality of second nodes associated with the second sending address, sending second to-be-transmitted information to the plurality of second nodes, and acquiring second reply information returned by the plurality of second nodes to the second sending address.
In this step, addresses subsequent to the first transmission address may be sequentially extracted according to a generation order of the M addresses, and it may be determined whether the number of nodes communicable with the address is greater than a first threshold value, until the number of the extracted nodes communicable with the address is greater than the first threshold value, the extracted nodes are used as a second transmission address, then the terminal transmits second to-be-transmitted information to a plurality of second nodes communicable with the second transmission address, the second to-be-transmitted information is transmitted to the destination address via the plurality of first nodes, and second reply information returned by the destination terminal returns to the second transmission address via an original path of the transmitted information, and is received by the terminal.
Steps S21, S22, and S24 in this embodiment are similar to steps S11, S12, and S13 in the first embodiment, and are not repeated here to avoid redundancy.
Compared with the prior art, the method and the device not only ensure the reliability of message sending, reduce the searching time of the node corresponding to the address and improve the efficiency of message transmission; meanwhile, each address in the M addresses is respectively associated with the searched node which can be communicated with the address and stored, so that the address and the associated node can be selected from the current M addresses when subsequent messages are sent, the node is not required to be searched every time the messages are sent, and the message transmission efficiency is further improved.
A third embodiment of the present invention relates to a communication method. The third embodiment is substantially the same as the second embodiment, and mainly differs in that: in a second embodiment, after the searching for nodes communicable with each of the M addresses separately and simultaneously within the first preset time period, the method further includes: and associating and storing each address in the M addresses with the searched nodes which can communicate with the address. In the third embodiment of the present invention, after searching for nodes communicable with each of the M addresses respectively and simultaneously within the first preset time period, the method further includes: marking the addresses of which the number of nodes is greater than a first threshold value in the M addresses; and respectively associating and storing the marked address in the M addresses with the searched nodes which can communicate with the M addresses. And only the address with the node number larger than the first threshold value in the M addresses is associated with the corresponding node and stored, so that the space occupied by the memory is reduced.
As shown in fig. 3, the communication method in the present embodiment specifically includes the following steps:
s31: at least M addresses are acquired.
S32: and respectively and simultaneously searching nodes which can communicate with each address in the M addresses within a first preset time length.
S33: and marking the addresses of which the number of the nodes is greater than the first threshold value in the M addresses, and associating and storing the marked addresses in the M addresses with the searched nodes which can communicate with the addresses respectively.
In this step, the addresses may be sequentially fetched according to the generation sequence of the M addresses, and it is determined whether the number of nodes that can communicate with the addresses is greater than a first threshold, if so, the addresses are marked, and then all the marked addresses are associated with the nodes that can communicate with the addresses and stored.
S34: and selecting one address from the marked addresses as a first sending address, sending first to-be-transmitted information to a plurality of first nodes which can communicate with the first sending address, and acquiring first reply information returned by the first sending addresses by the plurality of first nodes.
In this step, since the marked addresses are addresses whose number of nodes is greater than the first threshold, selecting one address from the marked addresses as the first sending address ensures that the number of nodes communicable with the first sending address can meet the requirement, thereby ensuring the reliability of the terminal sending the first information to be transmitted to the plurality of first nodes communicable with the first sending address and the terminal subsequently acquiring the first reply information whose target address is returned to the first sending address via the plurality of first nodes.
S35: and selecting another address from the marked addresses as a second sending address, acquiring a plurality of second nodes associated with the second sending address, sending second to-be-transmitted information to the plurality of second nodes, and acquiring second reply information returned by the plurality of second nodes to the second sending address.
In this step, another address may be selected from the marked addresses as a second sending address according to the storage order of the marked addresses, and when the terminal subsequently needs to send another message, the terminal may send second to-be-transmitted information to a plurality of second nodes communicable with the second sending address and acquire first reply information of the destination address returned to the first sending address via the plurality of first nodes.
Steps S31, S32 in the present embodiment are similar to steps S21, S22 in the second embodiment, and are not repeated here to avoid redundancy.
Compared with the prior art, the method and the device for transmitting the message ensure the reliability of message transmission, reduce the searching time of the node corresponding to the address and improve the efficiency of message transmission; meanwhile, each address in the M addresses is respectively associated and stored with the searched node which can be communicated with the address, so that the address and the associated node can be selected from the current M addresses when subsequent messages are sent, the node is not required to be searched every time the message is sent, and the message transmission efficiency is further improved; and only the address with the node number larger than the first threshold value in the M addresses is associated with the corresponding node and stored, so that the space occupied by the memory is reduced.
A fourth embodiment of the present invention relates to a communication method. The fourth embodiment is substantially the same as the third embodiment, and mainly differs therefrom in that: in a fourth embodiment of the present invention, after the second transmission address is selected, the method further includes: acquiring the number of addresses of which the number of remaining nodes in the M addresses is greater than a first threshold value; if the number of the addresses is smaller than a second threshold value, nodes which can be communicated with each address in P addresses are searched respectively and simultaneously within a second preset time length, wherein the P addresses are not overlapped with the M addresses. If the number of the addresses is smaller than the second threshold value, the nodes capable of communicating with each address in the P addresses are searched respectively and simultaneously within the second preset time period, namely, when the number of the remaining available addresses is insufficient, the nodes capable of communicating with the next batch of addresses are searched in advance, so that the searched addresses can be directly acquired when the message is sent, the time for waiting for the addresses to search the nodes capable of communicating is saved, and the message sending efficiency is improved.
As shown in fig. 4, the communication method in the present embodiment specifically includes the following steps:
s41: at least M addresses and P addresses are obtained.
That is, only M addresses and P addresses needed to be used by two subsequent loads may be generated, or more addresses may be generated for subsequent use, that is, a plurality of batches of addresses needed to be loaded are generated at one time.
S42: and respectively and simultaneously searching nodes which can communicate with each address in the M addresses within a first preset time length.
S43: and marking the addresses of which the number of the nodes is greater than the first threshold value in the M addresses, and associating and storing the marked addresses in the M addresses with the searched nodes which can communicate with the addresses respectively.
S44: and selecting one address from the marked addresses as a first sending address, sending first to-be-transmitted information to a plurality of first nodes which can communicate with the first sending address, and acquiring first reply information returned by the plurality of first nodes to the first sending address.
S45: and selecting another address from the marked addresses as a second sending address, acquiring a plurality of second nodes associated with the second sending address, sending second to-be-transmitted information to the plurality of second nodes, and acquiring second reply information returned by the plurality of second nodes to the second sending address.
S46: the number of addresses remaining in the tagged address is retrieved.
In this step, the remaining number of addresses is specifically: the number of addresses of the marked addresses that are not used as sending addresses for messaging, i.e. the number of unused nodes is greater than the first threshold.
S47: and when the number of the addresses is smaller than a second threshold value, searching nodes which can be communicated with each address in the P addresses respectively and simultaneously within a second preset time length.
And when the number of the addresses is less than a second threshold, searching nodes which can communicate with each address in the P addresses respectively and simultaneously within a second preset time period, wherein the second threshold can be set according to needs, for example, the second threshold can be 5, that is, when the number of the remaining marked addresses is less than 5, searching nodes which can communicate with each address in the P addresses in the next batch is started.
Specifically, the second preset duration may be the same as or different from the first preset duration, P may be equal to or not equal to N, optionally, P ≧ 2, and the specific search process is similar to the foregoing one, and is not described herein again.
Steps S41, S42, S43, S44, and S45 in the present embodiment are similar to steps S31, S32, S33, S34, and S35 in the second embodiment, and are not described again to avoid redundancy.
Certainly, steps S41, S42, S43, S44, and S45 in this embodiment may also be similar to steps S21, S22, S23, S24, and S25 in the second embodiment, at this time, the number of remaining addresses in the M addresses may be obtained, and if the number of addresses is less than a third threshold, nodes that can communicate with each address in the N addresses are respectively and simultaneously searched in a third preset time period, where the N addresses are not overlapped with the M addresses, the third threshold may be set as needed, for example, the number of the third threshold may be 5, and the third preset time period may be the same as or different from the first preset time period, and is not repeated here.
Compared with the prior art, the method and the device for transmitting the message ensure the reliability of message transmission, reduce the searching time of the node corresponding to the address and improve the efficiency of message transmission; meanwhile, each address in the M addresses is respectively associated and stored with the searched node which can be communicated with the address, so that the address and the associated node can be selected from the current M addresses when subsequent messages are sent, the node is not required to be searched every time the message is sent, and the message transmission efficiency is further improved; in addition, only the addresses with the number of nodes larger than the first threshold value in the M addresses are associated with the corresponding nodes and stored, so that the space occupied by the memory is reduced; in addition, when the number of the remaining available addresses is insufficient, the communicable nodes of the next group of addresses are searched in advance, so that the searched addresses can be directly acquired when the message is sent, the time for waiting the addresses to search the communicable nodes is saved, and the message sending efficiency is improved.
A fifth embodiment of the present invention relates to a communication method. The fifth embodiment is substantially the same as the fourth embodiment, and mainly differs therefrom in that: in a fourth embodiment, the obtaining at least M addresses specifically includes: at least M addresses and P addresses are obtained. In a fifth embodiment of the present invention, the acquiring at least M addresses specifically includes: acquiring the M addresses; before searching for a node communicable with each address of the P addresses respectively and simultaneously within a second preset time, the method further includes: and acquiring the P addresses. The next address is generated when the communicable node of the next address needs to be searched, so that time waste caused by incomplete subsequent use after excessive addresses are generated at one time is avoided, and meanwhile, the sending efficiency of the first information to be transmitted is improved.
As shown in fig. 5, the communication method in the present embodiment specifically includes the following steps:
s51: m addresses are obtained.
In this step, only the address required by the current loading (searching for the node with which the address can communicate) is generated, so that excessive time is not wasted for generating the address, and the efficiency of subsequently sending the first information to be transmitted is improved.
S52: and respectively and simultaneously searching nodes which can communicate with each address in the M addresses within a first preset time length.
S53: and marking the addresses of which the number of the nodes is greater than the first threshold value in the M addresses, and associating and storing the marked addresses in the M addresses with the searched nodes which can communicate with the addresses respectively.
S54: and selecting one address from the marked addresses as a first sending address, sending first to-be-transmitted information to a plurality of first nodes which can communicate with the first sending address, and acquiring first reply information returned by the first sending addresses by the plurality of first nodes.
S55: and selecting another address from the marked addresses as a second sending address, acquiring a plurality of second nodes associated with the second sending address, sending second to-be-transmitted information to the plurality of second nodes, and acquiring second reply information returned by the plurality of second nodes to the second sending address.
S56: the number of addresses remaining in the tagged address is retrieved.
S57: and when the number of the addresses is smaller than a second threshold value, acquiring the P addresses, and respectively and simultaneously searching nodes which can communicate with each address in the P addresses in a second preset time length.
In this step, a process of acquiring the P addresses is similar to the process of acquiring the M addresses, and "searching for a node communicable with each address in the P addresses within a second preset duration respectively and simultaneously" is similar to that in the fourth embodiment, and is not repeated here, where the second preset duration may be the same as or different from the first preset duration, P may be equal to or different from N, and optionally, P ≧ 2.
Steps S52, S53, S54, S55, and S56 in the present embodiment are similar to steps S42, S43, S44, S45, and S46 in the second embodiment, and are not described again to avoid redundancy.
Compared with the prior art, the method and the device for transmitting the message ensure the reliability of message transmission, reduce the searching time of the node corresponding to the address and improve the efficiency of message transmission; meanwhile, each address in the M addresses is respectively associated and stored with the searched node which can be communicated with the address, so that the address and the associated node can be selected from the current M addresses when subsequent messages are sent, the node is not required to be searched every time the message is sent, and the message transmission efficiency is further improved; in addition, only the addresses with the number of nodes larger than the first threshold value in the M addresses are associated with the corresponding nodes and stored, so that the space occupied by a memory is reduced; in addition, when the number of the remaining available addresses is insufficient, the communicable nodes of the next group of addresses are searched in advance, so that the searched addresses can be directly obtained when the message is sent, the time for waiting the addresses to search the communicable nodes is saved, and the message sending efficiency is improved; and the next address is generated when the communicable node of the next address needs to be searched, so that the time waste caused by one-time generation of excessive addresses and subsequent use is avoided, and meanwhile, the sending efficiency of the first to-be-transmitted information is improved.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
A sixth embodiment of the present invention relates to a terminal, as shown in fig. 6, including:
at least one processor 601; and the number of the first and second groups,
a memory 602 communicatively coupled to the at least one processor 601; wherein,
the memory 602 stores instructions executable by the at least one processor 601 to cause the at least one processor 601 to perform the above-described communication method.
Where the memory 602 and the processor 601 are coupled by a bus, the bus may comprise any number of interconnected buses and bridges that couple one or more of the various circuits of the processor 601 and the memory 602 together. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 601 is transmitted over a wireless medium via an antenna, which further receives the data and transmits the data to the processor 601.
The processor 601 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. While memory 602 may be used to store data used by processor 601 in performing operations.
A seventh embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
That is, as can be understood by those skilled in the art, all or part of the steps in the method for implementing the embodiments described above may be implemented by a program instructing related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.

Claims (9)

1. A method of communication, comprising:
acquiring at least M addresses, wherein M is not less than 2;
respectively and simultaneously searching nodes which can communicate with each address in the M addresses within a first preset time length;
selecting an address with the node number larger than a first threshold value from the M addresses as a first sending address, sending first to-be-transmitted information to a plurality of first nodes which can communicate with the first sending address, and acquiring first return information of the first nodes returning the first sending address, wherein the first sending address is an address used by a terminal for sending the first to-be-transmitted information.
2. The communication method according to claim 1, wherein after separately and simultaneously searching for nodes communicable with each of the M addresses within the first preset time period, the method further comprises:
associating and storing each address in the M addresses with the searched nodes which can communicate with the address;
after the obtaining of the first reply information returned by the plurality of first nodes, the method further includes:
selecting an address with the number of other nodes larger than a first threshold value from the M addresses as a second sending address, and acquiring a plurality of second nodes associated with the second sending address;
and sending second information to be transmitted to the plurality of second nodes, and acquiring second reply information of the second sending address returned by the plurality of second nodes.
3. The communication method according to claim 1, wherein after separately and simultaneously searching for nodes communicable with each of the M addresses within the first preset time period, the method further comprises:
marking the addresses of which the number of nodes is greater than a first threshold value in the M addresses;
respectively associating and storing the marked address in the M addresses with the searched nodes which can be communicated with the M addresses;
the selecting, as the first sending address, an address whose node number is greater than a first threshold from the M addresses specifically includes:
selecting an address from the tagged addresses as the first sending address.
4. The communication method according to claim 3, wherein after acquiring the first reply information returned by the plurality of first nodes, further comprising:
selecting another address from the marked addresses as a second sending address, and acquiring a plurality of second nodes associated with the second sending address;
and sending second information to be transmitted to the plurality of second nodes, and acquiring second reply information of the second sending addresses returned by the plurality of second nodes.
5. The communication method according to any one of claims 2 or 4, further comprising, after selecting the second transmission address:
acquiring the number of addresses of which the number of remaining nodes in the M addresses is greater than a first threshold value;
if the number of the addresses is smaller than a second threshold value, nodes which can be communicated with each address in P addresses are searched respectively and simultaneously within a second preset time length, wherein the P addresses are not overlapped with the M addresses.
6. The communication method according to claim 5, wherein the obtaining of at least M addresses specifically comprises: at least the M addresses and the P addresses are obtained.
7. The communication method according to claim 5, wherein the obtaining of the at least M addresses specifically includes:
acquiring the M addresses;
before searching for a node communicable with each address of the P addresses respectively and simultaneously within a second preset time, the method further includes:
and acquiring the P addresses, wherein P ≧ 2.
8. A terminal, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the communication method of any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the communication method of any one of claims 1 to 7.
CN201911181464.6A 2019-11-27 2019-11-27 Communication method, terminal, and computer-readable storage medium Active CN110932980B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911181464.6A CN110932980B (en) 2019-11-27 2019-11-27 Communication method, terminal, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911181464.6A CN110932980B (en) 2019-11-27 2019-11-27 Communication method, terminal, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN110932980A CN110932980A (en) 2020-03-27
CN110932980B true CN110932980B (en) 2022-09-20

Family

ID=69852220

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911181464.6A Active CN110932980B (en) 2019-11-27 2019-11-27 Communication method, terminal, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN110932980B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101145976A (en) * 2007-10-31 2008-03-19 北京航空航天大学 Super-node selection and resource search method for peer network with node priority
CN101378325A (en) * 2007-08-31 2009-03-04 华为技术有限公司 Superposition network and building method thereof
CN101741731A (en) * 2009-12-03 2010-06-16 中兴通讯股份有限公司 Content metadata storing, inquiring method and managing system in content delivery network (CDN)
CN101753610A (en) * 2008-12-19 2010-06-23 华为技术有限公司 Distributed network structure method, device, system and task processing method
CN102075974A (en) * 2011-01-10 2011-05-25 张俊虎 Method for searching high contiguity resources in wireless sensor network
CN103118435A (en) * 2012-12-11 2013-05-22 华为技术有限公司 Method, device and system of node scheduling
CN103746933A (en) * 2013-12-24 2014-04-23 乐视网信息技术(北京)股份有限公司 Node distribution method and control center

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7349971B2 (en) * 2004-02-05 2008-03-25 Scenera Technologies, Llc System for transmitting data utilizing multiple communication applications simultaneously in response to user request without specifying recipient's communication information
KR100633666B1 (en) * 2004-02-25 2006-10-12 엘지전자 주식회사 Home network server device and the control method of the same
US7808971B2 (en) * 2005-07-01 2010-10-05 Miller John L Routing cache for distributed hash tables
JP2009071563A (en) * 2007-09-13 2009-04-02 Ricoh Co Ltd Communication device
JP2010028551A (en) * 2008-07-22 2010-02-04 Brother Ind Ltd Content distributed storage system, node device, node processing program, and address information change notifying method
JP5300367B2 (en) * 2008-08-08 2013-09-25 キヤノン株式会社 Information processing apparatus, information processing method, and computer program
US11068850B2 (en) * 2009-05-23 2021-07-20 Verizon Media Inc. Managing electronic addresses based on communication patterns

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101378325A (en) * 2007-08-31 2009-03-04 华为技术有限公司 Superposition network and building method thereof
CN101145976A (en) * 2007-10-31 2008-03-19 北京航空航天大学 Super-node selection and resource search method for peer network with node priority
CN101753610A (en) * 2008-12-19 2010-06-23 华为技术有限公司 Distributed network structure method, device, system and task processing method
CN101741731A (en) * 2009-12-03 2010-06-16 中兴通讯股份有限公司 Content metadata storing, inquiring method and managing system in content delivery network (CDN)
CN102075974A (en) * 2011-01-10 2011-05-25 张俊虎 Method for searching high contiguity resources in wireless sensor network
CN103118435A (en) * 2012-12-11 2013-05-22 华为技术有限公司 Method, device and system of node scheduling
CN103746933A (en) * 2013-12-24 2014-04-23 乐视网信息技术(北京)股份有限公司 Node distribution method and control center

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
DHT 分布式哈希表;smallnest;《https://colobu.com/2018/03/26/distributed-hash-table/》;20180326;第5-6页 *

Also Published As

Publication number Publication date
CN110932980A (en) 2020-03-27

Similar Documents

Publication Publication Date Title
CN101350790B (en) Document transmission method and device base on instant communications system
EP3780438B1 (en) Data transmission method and related device
US8903972B2 (en) Method and apparatus for sharing contents using information of group change in content oriented network environment
CN110730254B (en) Address allocation method, device, relay equipment and medium
CN112532704B (en) Data transmission method, device, electronic equipment and storage medium
US20190372825A1 (en) Communication apparatus, communication method, and recording medium
US10051552B2 (en) Method for realizing resource attribute notification, and common service entity
CN108880972A (en) A kind of information processing method, server and terminal
CN108259348B (en) Message transmission method and device
CN111200640B (en) Uploading method based on client and client
CN110932980B (en) Communication method, terminal, and computer-readable storage medium
CN110888892B (en) Block synchronization method, device and storage medium
CN114866470A (en) Method, device, system and storage medium for sending message
US8688766B2 (en) Method for managing the allocation of data into a peer-to-peer network and peer implementing such method
CN114449031B (en) Information acquisition method, device, equipment and storage medium
CN108427691B (en) Network data transmission method and device and computer equipment
US20220350748A1 (en) Consistent hashing for communication devices
CN111061682B (en) Data caching method, reading method, electronic equipment and storage medium
CN116847432A (en) Subnet fusion method and device, electronic equipment and storage medium
CN113326119B (en) Method for deleting user equipment and related equipment
CN104756465B (en) A kind of method for routing, equipment and system
CN112671636A (en) Group message pushing method and device, computer equipment and storage medium
WO2016197995A1 (en) Method and device for realizing stateful operation in stateless network protocol
CN109688204A (en) Document down loading method, device based on NDN network, node, terminal
CN113242307B (en) Service request processing method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20210207

Address after: 200245 2nd floor, building 2, no.1508, Kunyang Road, Minhang District, Shanghai

Applicant after: Dalu Robot Co.,Ltd.

Address before: 610094 West Section of Fucheng Avenue, Chengdu High-tech District, Sichuan Province

Applicant before: CLOUDMINDS (CHENGDU) TECHNOLOGIES Co.,Ltd.

TA01 Transfer of patent application right
CB02 Change of applicant information

Address after: 200245 Building 8, No. 207, Zhongqing Road, Minhang District, Shanghai

Applicant after: Dayu robot Co.,Ltd.

Address before: 200245 2nd floor, building 2, no.1508, Kunyang Road, Minhang District, Shanghai

Applicant before: Dalu Robot Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant