[go: up one dir, main page]

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
nodes
address
communicate
sending
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

本发明实施例涉及通信技术领域,特别涉及一种通信方法、终端及计算机可读存储介质。Embodiments of the present invention relate to the field of communication technologies, and in particular, to a communication method, a terminal, and a computer-readable storage medium.

背景技术Background technique

聊天软件里,一般是使用集中式的服务器提供后台业务,但有些场景,为了安全,会偏向于使用DHT网络进行通信。DHT全称叫分布式哈希表(Distributed Hash Table),是一种分布式存储方法。即,在不需要服务器的情况下,每个客户端负责一个小范围的路由,并负责存储一小部分数据,从而实现整个DHT网络的寻址和存储。现有技术中,在DHT的网络环境中发消息,都要有两个步骤,分别是:1)查找地址对应的分布较近并且在线的一批节点;2)向这批节点发送对应的内容。In chat software, centralized servers are generally used to provide background services, but in some scenarios, for security reasons, DHT networks are preferred for communication. The full name of DHT is Distributed Hash Table, which is a distributed storage method. That is, without the need for a server, each client is responsible for a small range of routing and is responsible for storing a small portion of data, thereby realizing addressing and storage of the entire DHT network. In the prior art, there are two steps to send a message in the network environment of DHT, respectively: 1) search for a group of nodes whose addresses are relatively close and online; 2) send the corresponding content to this group of nodes .

发明人发现现有技术中至少存在如下问题:为了保证消息传输的可靠性,查找地址对应的节点通常需要花费很长时间,导致消息传输的效率较低。The inventor finds that there are at least the following problems in the prior art: in order to ensure the reliability of message transmission, it usually takes a long time to find a node corresponding to an address, resulting in low efficiency of message transmission.

发明内容SUMMARY OF THE INVENTION

本发明实施方式的目的在于提供一种通信方法、终端及计算机可读存储介质,能够在保证消息传输的可靠性的前提下,提高消息传输的效率。The purpose of the embodiments of the present invention is to provide a communication method, a terminal, and a computer-readable storage medium, which can improve the efficiency of message transmission on the premise of ensuring the reliability of message transmission.

为解决上述技术问题,本发明的实施方式提供了一种通信方法,包括:获取至少M个地址,其中,M≧2;在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点;从所述M个地址中选定一个节点数量大于第一阈值的地址作为第一发送地址,向与所述第一发送地址可通信的多个第一节点发送第一待传输信息,并获取所述多个第一节点返回所述第一发送地址的第一回复信息。In order to solve the above-mentioned technical problem, an embodiment of the present invention provides a communication method, including: acquiring at least M addresses, where M≧2; within a first preset time period, searching for each of the M addresses separately and simultaneously. nodes with communicable addresses; select an address whose number of nodes is greater than the first threshold from the M addresses as the first sending address, and send the first sending address to a plurality of first nodes that can communicate with the first sending address information to be transmitted, and obtain the first reply information returned by the plurality of first nodes to the first sending address.

本发明的实施方式还提供了一种终端,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至7中任一所述的通信方法。Embodiments of the present invention also provide a terminal, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a program executable by the at least one processor. instructions, the instructions being executed by the at least one processor to enable the at least one processor to perform a communication method as claimed in any one of claims 1 to 7.

本发明的实施方式还提供了一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现上述的通信方法。Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-mentioned communication method is implemented.

本发明实施方式相对于现有技术而言,通过在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点,由于查找了M个地址对应的可通信的节点,从而能够保证M个地址中至少会有一个地址对应的节点数量满足要求,使得后续能够从所述M个地址中选定一个节点数量大于第一阈值的地址作为第一发送地址,即,保证了第一发送地址对应的可通信的节点数量能够满足需求,进而保证了消息发送的可靠性,故无需将第一预设时长设置得过大来保证节点数量足够大,同时,由于M个地址中每个地址对应的可通信的节点是同时进行查找的,即,利用程序的并发处理使得查找的节点又多又快,从而仅需花费第一预设时长即可完成M个地址对应的可通信的节点的查找,减小了地址对应的节点的查找时间,提高了消息传输的效率。Compared with the prior art, the embodiment of the present invention searches for nodes that can communicate with each of the M addresses respectively and simultaneously within the first preset time period, because the communicable nodes corresponding to the M addresses are searched for. , which can ensure that at least one of the M addresses corresponds to the number of nodes that meet the requirements, so that an address whose number of nodes is greater than the first threshold can be selected from the M addresses as the first sending address, that is, to ensure that This ensures that the number of communicable nodes corresponding to the first sending address can meet the demand, thereby ensuring the reliability of message sending. Therefore, it is not necessary to set the first preset duration to be too large to ensure that the number of nodes is large enough. At the same time, since there are M addresses The communicable nodes corresponding to each address are searched at the same time, that is, the concurrent processing of the program is used to make the searched nodes many and fast, so that it only takes the first preset time to complete the communication corresponding to the M addresses. The search of the communication node reduces the search time of the node corresponding to the address and improves the efficiency of message transmission.

另外,所述在第一预设时长内,分别且同时查找与所述M个地址中每个地址可通信的节点之后,还包括:将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存;所述获取所述多个第一节点返回的第一回复信息之后,还包括:从所述M个地址中选定另一个节点数量大于第一阈值的地址作为第二发送地址,并获取与所述第二发送地址关联的多个第二节点;向所述多个第二节点发送第二待传输信息,并获取所述多个第二节点返回所述第二发送地址的第二回复信息。通过将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存,从而后续发消息时可从本次的M个地址中选取地址以及关联的节点,无需每次发消息均进行节点的查找,进一步提高了消息传输的效率。In addition, after searching for nodes that can communicate with each of the M addresses respectively and simultaneously within the first preset time period, the method further includes: comparing each of the M addresses with the found node respectively. Associating and saving the nodes with which it can communicate; after acquiring the first reply information returned by the multiple first nodes, the method further includes: selecting another address whose number of nodes is greater than the first threshold from the M addresses as the second sending address, and obtain multiple second nodes associated with the second sending address; send second information to be transmitted to the multiple second nodes, and obtain the multiple second nodes and return the The second reply information of the second sending address. By associating and saving each of the M addresses with the found node that can communicate with it, the address and the associated node can be selected from the current M addresses when sending a message later, without the need for each time Node search is performed for all messages sent, which further improves the efficiency of message transmission.

另外,所述在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点之后,还包括:将所述M个地址中节点数量大于第一阈值的地址进行标记;将所述M个地址中被标记的地址分别与查找到的与其可通信的节点进行关联并保存;所述从所述M个地址中选定一个节点数量大于第一阈值的地址作为第一发送地址,具体为:从所述被标记的地址中选定一个地址作为所述第一发送地址。In addition, after searching for nodes that can communicate with each of the M addresses within the first preset time period, respectively and simultaneously, the method further includes: marking the addresses of the M addresses whose number of nodes is greater than the first threshold. ; The marked addresses in the M addresses are respectively associated with the found and communicable nodes and save; The described M addresses are selected from an address whose number of nodes is greater than the first threshold as the first The sending address is specifically: selecting an address from the marked addresses as the first sending address.

另外,所述获取所述多个第一节点返回的第一回复信息之后,还包括:从所述被标记的地址中选定另一个地址作为第二发送地址,并获取与所述第二发送地址关联的多个第二节点;向所述多个第二节点发送第二待传输信息,并获取所述多个第二节点返回所述第二发送地址的第二回复信息。通过将所述M个地址中节点数量大于第一阈值的地址进行标记,并将所述M个地址中被标记的地址分别与查找到的与其可通信的节点进行关联并保存,使得在发送第二待传输信息,能够直接从所述被标记的地址中选定另一个地址作为第二发送地址,无需每次发消息均进行节点的查找,进一步提高了消息传输的效率。In addition, after acquiring 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 obtaining the address related to the second sending address. multiple second nodes associated with the addresses; sending second information to be transmitted to the multiple second nodes, and acquiring second reply information returned by the multiple second nodes to the second sending address. By marking the addresses with the number of nodes greater than the first threshold in the M addresses, and associating and saving the marked addresses in the M addresses with the found nodes that can communicate with them, so that when sending the first Second, for the information to be transmitted, another address can be directly selected from the marked addresses as the second sending address, and there is no need to search for nodes every time a message is sent, which further improves the efficiency of message transmission.

另外,选定所述第二发送地址之后,还包括:获取所述M个地址中剩余的节点数量大于第一阈值的地址的地址数量;若所述地址数量小于第二阈值,则在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点,其中,所述P个地址与所述M个地址不重叠。通过若所述地址数量小于第二阈值,则在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点,即,在剩余的可用的地址的数量不足时,提前进行下一批的地址的可通信节点的查找,从而在发消息时能够直接获取到查找完毕的地址,节省了等待地址查找可通信节点的时间,提高了消息发送的效率。In addition, after the second sending address is selected, the method further includes: acquiring the address number of the addresses whose node number is greater than the first threshold in the M addresses; if the address number is less than the second threshold, the second Within a preset time period, nodes that can communicate with each of the P addresses are searched separately and simultaneously, wherein the P addresses do not overlap with the M addresses. If the number of addresses is less than the second threshold, within the second preset time period, separately and simultaneously search for nodes that can communicate with each of the P addresses, that is, when the number of remaining available addresses is insufficient, The search for the communicable nodes of the next batch of addresses is carried out in advance, so that the searched addresses can be directly obtained when sending a message, which saves time waiting for addresses to find communicable nodes, and improves the efficiency of message sending.

另外,所述获取至少M个地址,具体为:至少获取所述M个地址和所述P个地址。In addition, the acquiring at least M addresses is specifically: acquiring at least the M addresses and the P addresses.

另外,所述获取至少M个地址,具体为:获取所述M个地址;所述在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点之前,还包括:获取所述P个地址,其中,P≧2。In addition, the acquiring at least M addresses is specifically: acquiring the M addresses; before searching for nodes that can communicate with each of the P addresses respectively and simultaneously within the second preset time period, further comprising: : Obtain the P addresses, where P≧2.

附图说明Description of drawings

一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定,附图中具有相同参考数字标号的元件表示为类似的元件,除非有特别申明,附图中的图不构成比例限制。One or more embodiments are exemplified by the pictures in the corresponding drawings, and these exemplifications do not constitute limitations of the embodiments, and elements with the same reference numerals in the drawings are denoted as similar elements, Unless otherwise stated, the figures in the accompanying drawings do not constitute a scale limitation.

图1是本发明第一实施方式提供的通信方法的流程图;1 is a flowchart of a communication method provided by a first embodiment of the present invention;

图2是本发明第二实施方式提供的通信方法的流程图;2 is a flowchart of a communication method provided by a second embodiment of the present invention;

图3是本发明第三实施方式提供的通信方法的流程图;3 is a flowchart of a communication method provided by a third embodiment of the present invention;

图4是本发明第四实施方式提供的通信方法的流程图;4 is a flowchart of a communication method provided by a fourth embodiment of the present invention;

图5是本发明第五实施方式提供的通信方法的流程图;5 is a flowchart of a communication method provided by a fifth embodiment of the present invention;

图6是本发明第六实施方式提供的终端的结构示意图。FIG. 6 is a schematic structural diagram of a terminal provided by a sixth embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合附图对本发明的各实施方式进行详细的阐述。然而,本领域的普通技术人员可以理解,在本发明各实施方式中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本申请所要求保护的技术方案。In order to make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the various embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, those of ordinary skill in the art can appreciate that, in the various embodiments of the present invention, many technical details are set forth in order for the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can be realized.

本发明的第一实施方式涉及一种通信方法,如图1所示,包括以下步骤:The first embodiment of the present invention relates to a communication method, as shown in FIG. 1 , including the following steps:

S11:获取至少M个地址。S11: Acquire at least M addresses.

具体的说,可以仅获取M个地址,也可以获取多于M个地址,其中,地址的具体形式与SHA1散列值类似,可以为一个长达160bit的整数,它是随机生成的,其与其他节点拥有同一地址的可能性非常之小,几乎是不可能的。Specifically, only M addresses can be obtained, or more than M addresses can be obtained. The specific form of the address is similar to the SHA1 hash value, and it can be an integer of up to 160 bits, which is randomly generated, which is similar to the SHA1 hash value. The probability of other nodes having the same address is very small, almost impossible.

S12:在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点。S12: Within the first preset time period, separately and simultaneously search for nodes that can communicate with each of the M addresses.

本步骤中,设定查找时长为第一预设时长,分别且同时查找与M个地址中每个地址可通信的节点,并且,查找每个地址可通信的节点的步骤均是同时进行的,当查找时长达到第一预设时长时,停止每个地址可通信的节点的查找。其中,第一预设时长可以根据需要进行设定,其可以设置为一个不太影响聊天体验的值,比如5秒,M可以根据经验进行设定,只要保证在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点时,至少存在一个地址查找到的可通信的节点数量能够满足发送第一待传输信息、以及回复信息的需求即可,例如,M等于20,此时,通常会有30%到50%的地址查找到的可通信的节点数量能够满足需求。In this step, the search duration is set as the first preset duration, and the nodes that can communicate with each of the M addresses are searched separately and simultaneously, and the steps of searching for the nodes that can communicate with each address are performed simultaneously, When the search time period reaches the first preset time period, the search of each node that can communicate with each address is stopped. Among them, the first preset duration can be set as required, and it can be set to a value that does not affect the chatting experience, such as 5 seconds, M can be set according to experience, as long as it is ensured that within the first preset duration, respectively And when searching for nodes that can communicate with each of the M addresses at the same time, there is at least one address that can find the number of communicable nodes that can meet the needs of sending the first information to be transmitted and replying to the information. For example, M is equal to 20. At this time, there are usually 30% to 50% of the addresses found and the number of communicable nodes that can meet the demand.

具体的,“与地址可通信的节点”可以理解为:与该地址距离较近并且在线的节点,其中,两个节点之间距离并不是依靠物理距离、路由器跳数来衡量的,距离d定义为其二者ID值的逐比特二进制和数,即,假定两个节点的ID分别为a与b,则有:d=a XORb。每一个节点都可以根据这一距离概念来判断其他节点距离自己的“远近”,当d值大时,节点间距离较远,而当d值小时,则两个节点相距很近。这里的“远近”和“距离”都只是一种逻辑上的度量描述而已,即这里的距离这一度量是无方向性的,也就是说a到b的距离恒等于b到a的距离。Specifically, "a node that can communicate with an address" can be understood as a node that is close to the address and is online, wherein the distance between two nodes is not measured by physical distance or router hop count, and the distance d is defined by It is the bit-by-bit binary sum of the two ID values, that is, assuming that the IDs of the two nodes are a and b, respectively, there is: d=a XORb. Each node can judge the distance between other nodes according to this distance concept. When the value of d is large, the distance between nodes is farther, and when the value of d is small, the two nodes are very close. The "far and near" and "distance" here are only a logical metric description, that is, the metric of distance here is non-directional, that is to say, the distance from a to b is always equal to the distance from b to a.

在实际应用中,每个地址对应的可通信的节点的查找过程大致如下:a.由查询发起者从自己的k-桶中筛选出若干距离目标ID最近的节点,并向这些节点同时发送异步查询请求;b.被查询节点收到请求之后,将从自己的k-桶中找出自己所知道的距离查询目标ID最近的若干个节点,并返回给发起者;c.发起者在收到这些返回信息之后,再次从自己所有已知的距离目标较近的节点中挑选出若干没有请求过的,并重复步骤1;d.上述步骤不断重复,直至无法获得比查询者当前已知的k个节点更接近目标的活动节点为止;e.在查询过程中,没有及时响应的节点将立即被排除;查询者必须保证最终获得的k个最节点都是活动的。In practical applications, the search process of the communicable nodes corresponding to each address is roughly as follows: a. The query initiator selects several nodes closest to the target ID from its own k-bucket, and sends asynchronous messages to these nodes at the same time. Query request; b. After the queried node receives the request, it will find out several nodes that it knows are closest to the query target ID from its own k-bucket, and return it to the initiator; c. The initiator receives the request. After the returned information, select a number of nodes that have not been requested from all the known nodes that are closer to the target, and repeat step 1; d. The above steps are repeated until it is impossible to obtain k that is better than the current known by the queryer. The nodes are closer to the active node of the target; e. During the query process, the nodes that do not respond in time will be immediately excluded; the queryer must ensure that the k most nodes obtained are active.

S13:从M个地址中选定一个节点数量大于第一阈值的地址作为第一发送地址,向与第一发送地址可通信的多个第一节点发送第一待传输信息,并获取多个第一节点返回第一发送地址的第一回复信息。S13: Select an address whose number of nodes is greater than the first threshold from the M addresses as the first sending address, send the first information to be transmitted to multiple first nodes that can communicate with the first sending address, and obtain multiple first sending addresses. A node returns the first reply information of the first sending address.

本步骤中,可以按照M个地址的生成顺序从M个地址中依次取出地址、并判断与该地址可通信的节点的数量是否大于第一阈值,直到取出的地址可通信的节点数量大于第一阈值,则将其作为第一发送地址,其中,第一阈值可以根据需要进行设定,本实施方式中,第一阈值为保证可以发送待传输消息、并接收到第一回复消息的最小节点数量。In this step, addresses can be sequentially extracted from the M addresses according to the generation sequence of the M addresses, and it is determined whether the number of nodes that can communicate with the address is greater than the first threshold, until the number of nodes that can communicate with the extracted address is greater than the first threshold. threshold, it is used as the first sending address, where the first threshold can be set as required. In this embodiment, the first threshold is the minimum number of nodes that can ensure that the message to be transmitted can be sent and the first reply message can be received .

可以理解的是,当在步骤S11中获取的地址的数量大于M个时,选取第一发送地址可以是按地址的生成顺序从所有的地址进行选取,此时可能存在选取的地址尚未查找过与其可通信的节点,此时需要加载(即,查找过与地址可通信的节点)一批地址,等待该批地址加载完毕才可以使用该地址,若加载的是后续的地址,是预备后续使用的,因其不影响本次使用,就可以不用等待。It can be understood that, when the number of addresses obtained in step S11 is greater than M, selecting the first sending address may be selected from all addresses in the order in which the addresses are generated. At this time, there may be selected addresses that have not been searched for. For nodes that can communicate, it is necessary to load (that is, find nodes that can communicate with addresses) a batch of addresses, and wait for the batch of addresses to be loaded before using the addresses. If the subsequent addresses are loaded, they are prepared for subsequent use. , because it does not affect this use, you don't have to wait.

选定第一发送地址之后,终端向与第一发送地址可通信的多个第一节点发送第一待传输信息,经由多个第一节点将该第一待传输信息发送至目标地址,目标终端返回的第一回复信息经由发送信息的原路径返回第一发送地址、从而被终端接收。After selecting the first sending address, the terminal sends the first information to be transmitted to a plurality of first nodes that can communicate with the first sending address, and sends the first information to be transmitted to the target address via the plurality of first nodes, and the target terminal The returned first reply information is returned to the first sending address via the original path for sending the information, so as to be received by the terminal.

本发明实施方式相对于现有技术而言,通过在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点,由于查找了M个地址对应的可通信的节点,从而能够保证M个地址中至少会有一个地址对应的节点数量满足要求,使得后续能够从所述M个地址中选定一个节点数量大于第一阈值的地址作为第一发送地址,即,保证了第一发送地址对应的可通信的节点数量能够满足需求,进而保证了消息发送的可靠性,故无需将第一预设时长设置得过大来保证节点数量足够大,同时,由于M个地址中每个地址对应的可通信的节点是同时进行查找的,即,利用程序的并发处理使得查找的节点又多又快,从而仅需花费第一预设时长即可完成M个地址对应的可通信的节点的查找,减小了地址对应的节点的查找时间,提高了消息传输的效率。Compared with the prior art, the embodiment of the present invention searches for nodes that can communicate with each of the M addresses respectively and simultaneously within the first preset time period, because the communicable nodes corresponding to the M addresses are searched for. , which can ensure that at least one of the M addresses corresponds to the number of nodes that meet the requirements, so that an address whose number of nodes is greater than the first threshold can be selected from the M addresses as the first sending address, that is, to ensure that This ensures that the number of communicable nodes corresponding to the first sending address can meet the demand, thereby ensuring the reliability of message sending. Therefore, it is not necessary to set the first preset duration to be too large to ensure that the number of nodes is large enough. At the same time, since there are M addresses The communicable nodes corresponding to each address are searched at the same time, that is, the concurrent processing of the program is used to make the searched nodes many and fast, so that it only takes the first preset time to complete the communication corresponding to the M addresses. The search of the communication node reduces the search time of the node corresponding to the address and improves the efficiency of message transmission.

本发明的第二实施方式涉及一种通信方法。第二实施方式与第一实施方式大致相同,主要区别之处在于:在本发明第二实施方式中,所述在第一预设时长内,分别且同时查找与所述M个地址中每个地址可通信的节点之后,还包括:将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存;所述获取所述多个第一节点返回的第一回复信息之后,还包括:从所述M个地址中选定另一个节点数量大于第一阈值的地址作为第二发送地址,并获取与所述第二发送地址关联的多个第二节点;向所述多个第二节点发送第二待传输信息,并获取所述多个第二节点返回所述第二发送地址的第二回复信息。通过将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存,从而后续发消息时可从本次的M个地址中选取地址以及关联的节点,无需每次发消息均进行节点的查找,进一步提高了消息传输的效率。A second embodiment of the present invention relates to a communication method. The second embodiment is substantially the same as the first embodiment, and the main difference is that: in the second embodiment of the present invention, within the first preset time period, the search is performed separately and simultaneously for each of the M addresses. After addressing the communicable nodes, the method further includes: associating and saving each of the M addresses with the found communicable nodes respectively; and obtaining the first replies returned by the plurality of first nodes After obtaining the information, the method further includes: selecting another address whose number of nodes is greater than the first threshold from the M addresses as the second sending address, and acquiring a plurality of second nodes associated with the second sending address; The plurality of second nodes send second information to be transmitted, and obtain second reply information returned by the plurality of second nodes to the second sending address. By associating and saving each of the M addresses with the found node that can communicate with it, the address and the associated node can be selected from the current M addresses when sending a message later, without the need for each time Node search is performed for all messages sent, which further improves the efficiency of message transmission.

本实施方式中的通信方法,如图2所示,具体包括以下步骤:The communication method in this embodiment, as shown in Figure 2, specifically includes the following steps:

S21:获取至少M个地址。S21: Acquire at least M addresses.

S22:在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点。S22: Search for nodes that can communicate with each of the M addresses respectively and simultaneously within the first preset time period.

S23:将M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存。S23: Associate and save each of the M addresses with the found node that can communicate with it.

具体的,将每个地址分别与查找到的与其可通信的节点进行关联并保存,从而后续能够在取出地址使用的过程中,能够找到关联的与其可通信的节点,并且,由于M个地址中每个地址均进行了保存,故本次发送消息之后剩余的地址还可以预留给后续发其它消息使用。Specifically, each address is associated and saved with the found node that can communicate with it, so that the associated node that can communicate with it can be found in the process of taking out the address and using it later. Each address is saved, so the remaining addresses after the message is sent this time can also be reserved for subsequent sending of other messages.

S24:从M个地址中选定一个节点数量大于第一阈值的地址作为第一发送地址,向与第一发送地址可通信的多个第一节点发送第一待传输信息,并获取多个第一节点返回第一发送地址的第一回复信息。S24: Select an address with a number of nodes greater than the first threshold from the M addresses as the first sending address, send the first information to be transmitted to multiple first nodes that can communicate with the first sending address, and obtain multiple first sending addresses A node returns the first reply information of the first sending address.

S25:从M个地址中选定另一个节点数量大于第一阈值的地址作为第二发送地址,并获取与第二发送地址关联的多个第二节点,向多个第二节点发送第二待传输信息,并获取多个第二节点返回第二发送地址的第二回复信息。S25: Select another address with a number of nodes greater than the first threshold from the M addresses as the second sending address, obtain multiple second nodes associated with the second sending address, and send the second pending address to the multiple second nodes Information is transmitted, and second reply information returned by multiple second nodes to the second sending address is obtained.

本步骤中,可以按照M个地址的生成顺序依次取出第一发送地址之后的地址、并判断与该地址可通信的节点的数量是否大于第一阈值,直到取出的地址可通信的节点数量大于第一阈值,则将其作为第二发送地址,之后,终端向与第二发送地址可通信的多个第二节点发送第二待传输信息,经由多个第一节点将该第二待传输信息发送至目标地址,目标终端返回的第二回复信息经由发送信息的原路径返回第二发送地址、从而被终端接收。In this step, the addresses after the first sending address can be sequentially extracted according to the generation sequence of the M addresses, and it is determined whether the number of nodes that can communicate with the address is greater than the first threshold, until the number of nodes that can communicate with the extracted address is greater than the number of nodes that can communicate with the address. If a threshold is reached, it is used as the second sending address. After that, the terminal sends the second information to be transmitted to multiple second nodes that can communicate with the second sending address, and sends the second information to be transmitted via multiple first nodes. To the target address, the second reply information returned by the target terminal returns to the second sending address via the original path for sending the information, so as to be received by the terminal.

本实施方式中的步骤S21、S22、S24与第一实施方式中的步骤S11、S12、S13类似,为了避免重复,此处不再赘述。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 in order to avoid repetition.

本发明实施方式相对于现有技术而言,不仅在保证消息发送的可靠性,减小了地址对应的节点的查找时间,提高了消息传输的效率;同时,通过将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存,从而后续发消息时可从本次的M个地址中选取地址以及关联的节点,无需每次发消息均进行节点的查找,进一步提高了消息传输的效率。Compared with the prior art, the embodiment of the present invention not only ensures the reliability of message transmission, but also reduces the search time of the node corresponding to the address, and improves the efficiency of message transmission; Each address is associated with the found node that can communicate with it and saved, so that the address and the associated node can be selected from the M addresses this time when sending a message later, without the need to search for a node every time a message is sent, and further The efficiency of message transmission is improved.

本发明的第三实施方式涉及一种通信方法。第三实施方式与第二实施方式大致相同,主要区别之处在于:在第二实施方式中,所述在第一预设时长内,分别且同时查找与所述M个地址中每个地址可通信的节点之后,还包括:将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存。而在本发明第三实施方式中,所述在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点之后,还包括:将所述M个地址中节点数量大于第一阈值的地址进行标记;将所述M个地址中被标记的地址分别与查找到的与其可通信的节点进行关联并保存。通过仅将将所述M个地址中节点数量大于第一阈值的地址与对应的节点进行关联并保存,减小了占用内存的空间。A third embodiment of the present invention relates to a communication method. The third embodiment is substantially the same as the second embodiment, and the main difference is that: in the second embodiment, within the first preset time period, the search is performed separately and simultaneously for each address in the M addresses. After communicating with the node, the method further includes: associating and saving each address of the M addresses with the found node that can communicate with it. In the third embodiment of the present invention, after searching for nodes that can communicate with each of the M addresses respectively and simultaneously within the first preset time period, the method further includes: adding the number of nodes in the M addresses to the number of nodes in the M addresses. The addresses larger than the first threshold are marked; the marked addresses among the M addresses are respectively associated with the found nodes that can communicate with them and saved. By associating and saving only the addresses of the M addresses whose number of nodes is greater than the first threshold with the corresponding nodes, the space occupied by the memory is reduced.

本实施方式中的通信方法,如图3所示,具体包括以下步骤:The communication method in this embodiment, as shown in Figure 3, specifically includes the following steps:

S31:获取至少M个地址。S31: Acquire at least M addresses.

S32:在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点。S32: Within the first preset time period, separately and simultaneously search for nodes that can communicate with each of the M addresses.

S33:将M个地址中节点数量大于第一阈值的地址进行标记,将M个地址中被标记的地址分别与查找到的与其可通信的节点进行关联并保存。S33: Mark the addresses in the M addresses whose number of nodes is greater than the first threshold, and associate and save the marked addresses in the M addresses with the found nodes that can communicate with them, respectively.

本步骤中,可以按照M个地址的生成顺序依次取出地址、并判断与该地址可通信的节点的数量是否大于第一阈值,若是,则将该地址进行标记,后续再将所有被标记的地址和与其可通信的节点进行关联并保存。In this step, the addresses can be taken out in sequence 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 the first threshold. Associate and save the node with which it can communicate.

S34:从被标记的地址中选定一个地址作为第一发送地址,向与第一发送地址可通信的多个第一节点发送第一待传输信息,并获取多个第一节点返回第一发送地址的第一回复信息。S34: Select an address from the marked addresses as the first sending address, send the first information to be transmitted to multiple first nodes that can communicate with the first sending address, and obtain multiple first nodes and return the first sending address The address of the first reply message.

本步骤中,由于被标记的地址均为节点数量大于第一阈值的地址,通过被标记的地址中选定一个地址作为第一发送地址,保证了与第一发送地址可通信的节点数量能够满足需求,从而保证了终端向与第一发送地址可通信的多个第一节点发送第一待传输信息、以及终端后续获取目标地址经由多个第一节点返回第一发送地址的第一回复信息的可靠性。In this step, since the marked addresses are all 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 that can communicate with the first sending address can satisfy This ensures that the terminal sends the first information to be transmitted to multiple first nodes that can communicate with the first sending address, and the terminal subsequently obtains the target address and returns the first reply information to the first sending address via multiple first nodes. reliability.

S35:从被标记的地址中选定另一个地址作为第二发送地址,并获取与第二发送地址关联的多个第二节点,向多个第二节点发送第二待传输信息,并获取多个第二节点返回第二发送地址的第二回复信息。S35: Select another address from the marked addresses as the second sending address, obtain multiple second nodes associated with the second sending address, send the second information to be transmitted to multiple second nodes, and obtain multiple second nodes. The second node returns the second reply information of the second sending address.

本步骤中,可以按照被标记的地址的保存顺序,从被标记的地址中选定另一个地址作为第二发送地址,终端后续再需要发送其他消息时,可以向与第二发送地址可通信的多个第二节点发送第二待传输信息、并获取目标地址经由多个第一节点返回第一发送地址的第一回复信息。In this step, another address may be selected from the marked addresses as the second sending address according to the order in which the marked addresses are saved. When the terminal needs to send other messages later, it may send a message to the address that can communicate with the second sending address. The plurality of second nodes send the second information to be transmitted, and obtain first reply information that the target address returns to the first sending address via the plurality of first nodes.

本实施方式中的步骤S31、S32与第二实施方式中的步骤S21、S22类似,为了避免重复,此处不再赘述。Steps S31 and S32 in this embodiment are similar to steps S21 and S22 in the second embodiment, and are not repeated here to avoid repetition.

本发明实施方式相对于现有技术而言,不仅在保证消息发送的可靠性,减小了地址对应的节点的查找时间,提高了消息传输的效率;同时,通过将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存,从而后续发消息时可从本次的M个地址中选取地址以及关联的节点,无需每次发消息均进行节点的查找,进一步提高了消息传输的效率;并且,通过仅将将所述M个地址中节点数量大于第一阈值的地址与对应的节点进行关联并保存,减小了占用内存的空间。Compared with the prior art, the embodiment of the present invention not only ensures the reliability of message transmission, but also reduces the search time of the node corresponding to the address, and improves the efficiency of message transmission; Each address is associated with the found node that can communicate with it and saved, so that the address and the associated node can be selected from the M addresses this time when sending a message later, without the need to search for a node every time a message is sent, and further The efficiency of message transmission is improved; and, by associating and saving only the addresses in the M addresses whose number of nodes is greater than the first threshold with the corresponding nodes, the space occupied by the memory is reduced.

本发明的第四实施方式涉及一种通信方法。第四实施方式与第三实施方式大致相同,主要区别之处在于:在本发明第四实施方式中,选定所述第二发送地址之后,还包括:获取所述M个地址中剩余的节点数量大于第一阈值的地址的地址数量;若所述地址数量小于第二阈值,则在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点,其中,所述P个地址与所述M个地址不重叠。通过若所述地址数量小于第二阈值,则在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点,即,在剩余的可用的地址的数量不足时,提前进行下一批的地址的可通信节点的查找,从而在发消息时能够直接获取到查找完毕的地址,节省了等待地址查找可通信节点的时间,提高了消息发送的效率。A fourth embodiment of the present invention relates to a communication method. The fourth embodiment is substantially the same as the third embodiment, and the main difference is that: in the fourth embodiment of the present invention, after the second sending address is selected, the method further includes: acquiring the remaining nodes in the M addresses The number of addresses of addresses whose number is greater than the first threshold; if the number of addresses is less than the second threshold, within the second preset time period, separately and simultaneously search for nodes that can communicate with each of the P addresses, where all The P addresses do not overlap the M addresses. If the number of addresses is less than the second threshold, within the second preset time period, separately and simultaneously search for nodes that can communicate with each of the P addresses, that is, when the number of remaining available addresses is insufficient, The search for the communicable nodes of the next batch of addresses is carried out in advance, so that the searched addresses can be directly obtained when sending a message, which saves time waiting for addresses to find communicable nodes, and improves the efficiency of message sending.

本实施方式中的通信方法,如图4所示,具体包括以下步骤:The communication method in this embodiment, as shown in FIG. 4 , specifically includes the following steps:

S41:至少获取M个地址和P个地址。S41: Obtain at least M addresses and P addresses.

也就是说,可以仅生成后续两次加载需要使用的M个地址和P个地址,也可以生成更多地址,以备后续使用,即,多批需要被加载的地址一次性进行生成。That is, only M addresses and P addresses to be used for subsequent two loads may be generated, or more addresses may be generated for subsequent use, that is, multiple batches of addresses to be loaded are generated at one time.

S42:在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点。S42: Within the first preset time period, separately and simultaneously search for nodes that can communicate with each of the M addresses.

S43:将M个地址中节点数量大于第一阈值的地址进行标记,将M个地址中被标记的地址分别与查找到的与其可通信的节点进行关联并保存。S43: Mark the addresses in the M addresses whose number of nodes is greater than the first threshold, and associate and save the marked addresses in the M addresses with the found nodes that can communicate with them, respectively.

S44:从被标记的地址中选定一个地址作为第一发送地址,向与第一发送地址可通信的多个第一节点发送第一待传输信息,并获取多个第一节点返回第一发送地址的第一回复信息。S44: Select one address from the marked addresses as the first sending address, send the first information to be transmitted to multiple first nodes that can communicate with the first sending address, and obtain multiple first nodes and return the first sending address The address of the first reply message.

S45:从被标记的地址中选定另一个地址作为第二发送地址,并获取与第二发送地址关联的多个第二节点,向多个第二节点发送第二待传输信息,并获取多个第二节点返回第二发送地址的第二回复信息。S45: Select another address from the marked addresses as the second sending address, obtain multiple second nodes associated with the second sending address, send the second information to be transmitted to multiple second nodes, and obtain multiple second nodes. The second node returns the second reply information of the second sending address.

S46:获取被标记的地址中剩余的地址数量。S46: Obtain the number of addresses remaining in the marked addresses.

本步骤中,剩余的地址数量具体为:被标记的地址中未被作为发送地址用来发消息的地址的数量,即,未被使用过的节点数量大于第一阈值的地址的数量。In this step, the number of remaining addresses is specifically: the number of addresses among the marked addresses that are not used as sending addresses to send messages, that is, the number of addresses whose number of unused nodes is greater than the first threshold.

S47:当地址数量小于第二阈值,则在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点。S47: When the number of addresses is less than the second threshold, within the second preset time period, search for nodes that can communicate with each of the P addresses respectively and simultaneously.

其中,所述P个地址与所述M个地址不重叠,即,所述P个地址为又一批新的地址,当地址数量小于第二阈值时,则在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点,其中,第二阈值可以根据需要进行设定,例如,第二阈值可以为5个,也就是说,当剩余的被标记的地址的数量小于5时,开始查找下一批的P个地址中每个地址可通信的节点。Wherein, the P addresses do not overlap with the M addresses, that is, the P addresses are another batch of new addresses, and when the number of addresses is less than the second threshold, within the second preset duration, respectively And at the same time search for nodes that can communicate with each of the P addresses, wherein the second threshold can be set as required, for example, the second threshold can be 5, that is, when the remaining marked addresses are When the number is less than 5, start to search for nodes that can communicate with each address in the next batch of P addresses.

具体的,第二预设时长与第一预设时长可以相同也可以不同,P可以等于或不等于N,可选的,P≧2,具体的查找过程与前述类似,此处不再赘述。Specifically, the second preset duration may be the same as or different from the first preset duration, and P may or may not be equal to N. Optionally, P≧2. The specific search process is similar to that described above, and will not be repeated here.

本实施方式中的步骤S41、S42、S43、S44、S45与第二实施方式中的步骤S31、S32、S33、S34、S35类似,为了避免重复,此处不再赘述。Steps S41 , S42 , S43 , S44 , and S45 in this embodiment are similar to steps S31 , S32 , S33 , S34 , and S35 in the second embodiment, and in order to avoid repetition, they will not be repeated here.

当然,本实施方式中的步骤S41、S42、S43、S44、S45也可以与第二实施方式中的步骤S21、S22、S23、S24、S25类似,此时,可以获取所述M个地址中剩余的地址数量,若所述地址数量小于第三阈值,则在第三预设时长内,分别且同时查找与N个地址中每个地址可通信的节点,其中,所述N个地址与所述M个地址不重叠,第三阈值可以根据需要进行设定,例如,可以为5个,第三预设时长与第一预设时长可以相同也可以不同,为了避免重复,此处不再赘述。Of course, steps S41, S42, S43, S44, and S45 in this embodiment can also be similar to steps S21, S22, S23, S24, and S25 in the second embodiment. In this case, the remaining M addresses can be obtained. number of addresses, if the number of addresses is less than the third threshold, then within a third preset time period, separately and simultaneously search for nodes that can communicate with each of the N addresses, where the N addresses and the The M addresses do not overlap, and the third threshold can be set as required, for example, five. The third preset duration and the first preset duration can be the same or different. To avoid repetition, details are not repeated here.

本发明实施方式相对于现有技术而言,不仅在保证消息发送的可靠性,减小了地址对应的节点的查找时间,提高了消息传输的效率;同时,通过将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存,从而后续发消息时可从本次的M个地址中选取地址以及关联的节点,无需每次发消息均进行节点的查找,进一步提高了消息传输的效率;并且,通过仅将将所述M个地址中节点数量大于第一阈值的地址与对应的节点进行关联并保存,减小了占用内存的空间;另外,通过在剩余的可用的地址的数量不足时,提前进行下一批的地址的可通信节点的查找,从而在发消息时能够直接获取到查找完毕的地址,节省了等待地址查找可通信节点的时间,提高了消息发送的效率。Compared with the prior art, the embodiment of the present invention not only ensures the reliability of message transmission, but also reduces the search time of the node corresponding to the address, and improves the efficiency of message transmission; Each address is associated with the found node that can communicate with it and saved, so that the address and the associated node can be selected from the M addresses this time when sending a message later, without the need to search for a node every time a message is sent, and further The efficiency of message transmission is improved; and, by only associating and saving the addresses with the number of nodes in the M addresses greater than the first threshold with the corresponding nodes, the space occupied by the memory is reduced; When the number of available addresses is insufficient, the next batch of addresses can be searched for communicable nodes in advance, so that the searched addresses can be directly obtained when sending a message, which saves the time waiting for addresses to find communicable nodes and improves the message Efficiency of sending.

本发明的第五实施方式涉及一种通信方法。第五实施方式与第四实施方式大致相同,主要区别之处在于:在第四实施方式中,所述获取至少M个地址,具体为:至少获取M个地址和P个地址。而在本发明第五实施方式中,所述获取至少M个地址,具体为:获取所述M个地址;所述在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点之前,还包括:获取所述P个地址。通过在需要查找下一批地址的可通信节点时再生成该下一批地址,避免了一次性生成过多的地址而后续使用不完造成的时间浪费,同时,提高了第一待传输信息的发送效率。A fifth embodiment of the present invention relates to a communication method. The fifth embodiment is substantially the same as the fourth embodiment, and the main difference is that: in the fourth embodiment, the acquiring at least M addresses is specifically: acquiring at least M addresses and P addresses. In the fifth embodiment of the present invention, the acquiring at least M addresses is specifically: acquiring the M addresses; and searching for each address in the P addresses separately and simultaneously within the second preset time period Before the communicable nodes, the method further includes: acquiring the P addresses. By generating the next batch of addresses when the communicable nodes of the next batch of addresses need to be searched, the waste of time caused by generating too many addresses at one time and not being used later is avoided. delivery efficiency.

本实施方式中的通信方法,如图5所示,具体包括以下步骤:The communication method in this embodiment, as shown in FIG. 5 , specifically includes the following steps:

S51:获取M个地址。S51: Obtain M addresses.

本步骤中,仅生成本次加载(查找与地址可通信的节点)所需的地址,从而不会浪费过多的时间用于生成地址,提高了后续发送第一待传输信息的效率。In this step, only the address required for this loading (finding the node that can communicate with the address) is generated, so that too much time is not wasted for generating the address, and the efficiency of subsequent sending of the first information to be transmitted is improved.

S52:在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点。S52: Search for nodes that can communicate with each of the M addresses respectively and simultaneously within the first preset time period.

S53:将M个地址中节点数量大于第一阈值的地址进行标记,将M个地址中被标记的地址分别与查找到的与其可通信的节点进行关联并保存。S53: Mark the addresses in the M addresses whose number of nodes is greater than the first threshold, and associate and save the marked addresses in the M addresses with the found nodes that can communicate with them, respectively.

S54:从被标记的地址中选定一个地址作为第一发送地址,向与第一发送地址可通信的多个第一节点发送第一待传输信息,并获取多个第一节点返回第一发送地址的第一回复信息。S54: Select one address from the marked addresses as the first sending address, send the first information to be transmitted to multiple first nodes that can communicate with the first sending address, and obtain multiple first nodes and return the first sending address The address of the first reply message.

S55:从被标记的地址中选定另一个地址作为第二发送地址,并获取与第二发送地址关联的多个第二节点,向多个第二节点发送第二待传输信息,并获取多个第二节点返回第二发送地址的第二回复信息。S55: Select another address from the marked addresses as the second sending address, obtain multiple second nodes associated with the second sending address, send the second information to be transmitted to multiple second nodes, and obtain multiple second nodes. The second node returns the second reply information of the second sending address.

S56:获取被标记的地址中剩余的地址数量。S56: Obtain the number of addresses remaining in the marked addresses.

S57:当地址数量小于第二阈值,则获取所述P个地址,并在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点。S57: When the number of addresses is less than the second threshold, acquire the P addresses, and search for nodes that can communicate with each of the P addresses respectively and simultaneously within a second preset time period.

本步骤中,获取所述P个地址的过程与前述获取M个地址的过程类似,“在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点”与第四实施方式中类似,此处不再赘述,其中,第二预设时长与第一预设时长可以相同也可以不同,P可以等于或不等于N,可选的,P≧2。In this step, the process of acquiring the P addresses is similar to the aforementioned process of acquiring the M addresses. "In the second preset time period, separately and simultaneously search for nodes that can communicate with each of the P addresses" and the first The fourth embodiment is similar and will not be repeated here. The second preset duration and the first preset duration may be the same or different, and P may or may not be equal to N. Optionally, P≧2.

本实施方式中的步骤S52、S53、S54、S55、S56与第二实施方式中的步骤S42、S43、S44、S45、S46类似,为了避免重复,此处不再赘述。Steps S52 , S53 , S54 , S55 , and S56 in this embodiment are similar to steps S42 , S43 , S44 , S45 , and S46 in the second embodiment, and are not repeated here to avoid repetition.

本发明实施方式相对于现有技术而言,不仅在保证消息发送的可靠性,减小了地址对应的节点的查找时间,提高了消息传输的效率;同时,通过将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存,从而后续发消息时可从本次的M个地址中选取地址以及关联的节点,无需每次发消息均进行节点的查找,进一步提高了消息传输的效率;并且,通过仅将将所述M个地址中节点数量大于第一阈值的地址与对应的节点进行关联并保存,减小了占用内存的空间;另外,通过在剩余的可用的地址的数量不足时,提前进行下一批的地址的可通信节点的查找,从而在发消息时能够直接获取到查找完毕的地址,节省了等待地址查找可通信节点的时间,提高了消息发送的效率;并且,通过在需要查找下一批地址的可通信节点时再生成该下一批地址,避免了一次性生成过多的地址而后续使用不完造成的时间浪费,同时,提高了第一待传输信息的发送效率。Compared with the prior art, the embodiment of the present invention not only ensures the reliability of message transmission, but also reduces the search time of the node corresponding to the address, and improves the efficiency of message transmission; Each address is associated with the found node that can communicate with it and saved, so that the address and the associated node can be selected from the M addresses this time when sending a message later, without the need to search for a node every time a message is sent, and further The efficiency of message transmission is improved; and, by only associating and saving the addresses with the number of nodes in the M addresses greater than the first threshold with the corresponding nodes, the space occupied by the memory is reduced; When the number of available addresses is insufficient, the next batch of addresses can be searched for communicable nodes in advance, so that the searched addresses can be directly obtained when sending a message, which saves the time waiting for addresses to find communicable nodes and improves the message Moreover, by regenerating the next batch of addresses when the communicable nodes of the next batch of addresses need to be searched, the time waste caused by generating too many addresses at one time and not being used subsequently is avoided, and at the same time, the The transmission efficiency of the first information to be transmitted.

上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包括相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。The steps of the above various methods are divided only for the purpose of describing clearly. During implementation, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as the same logical relationship is included, they are all within the protection scope of this patent. ;Adding insignificant modifications to the algorithm or process or introducing insignificant designs, but not changing the core design of the algorithm and process are all within the scope of protection of this patent.

本发明第六实施方式涉及一种终端,如图6所示,包括:The sixth embodiment of the present invention relates to a terminal, as shown in Figure 6, comprising:

至少一个处理器601;以及,at least one processor 601; and,

与至少一个处理器601通信连接的存储器602;其中,a memory 602 in communication with the at least one processor 601; wherein,

存储器602存储有可被至少一个处理器601执行的指令,指令被至少一个处理器601执行,以使至少一个处理器601能够执行上述通信方法。The memory 602 stores instructions executable by the at least one processor 601, and the instructions are executed by the at least one processor 601 to enable the at least one processor 601 to perform the above-described communication method.

其中,存储器602和处理器601采用总线方式连接,总线可以包括任意数量的互联的总线和桥,总线将一个或多个处理器601和存储器602的各种电路连接在一起。总线还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路连接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口在总线和收发机之间提供接口。收发机可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器601处理的数据通过天线在无线介质上进行传输,进一步,天线还接收数据并将数据传送给处理器601。The memory 602 and the processor 601 are connected by a bus, and the bus may include any number of interconnected buses and bridges, and the bus connects one or more processors 601 and various circuits of the memory 602 together. The bus may also connect together various other circuits, such as peripherals, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides the interface between the bus and the transceiver. A transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing a means for communicating with various other devices over a transmission medium. The data processed by the processor 601 is transmitted on the wireless medium through the antenna, and further, the antenna also receives the data and transmits the data to the processor 601 .

处理器601负责管理总线和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器602可以被用于存储处理器601在执行操作时所使用的数据。Processor 601 is responsible for managing the bus and general processing, and may also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. The memory 602 may be used to store data used by the processor 601 when performing operations.

本发明第七实施方式涉及一种计算机可读存储介质,存储有计算机程序。计算机程序被处理器执行时实现上述方法实施例。A seventh embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The above method embodiments are implemented when the computer program is executed by the processor.

即,本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。That is, those skilled in the art can understand that all or part of the steps in the method for implementing the above embodiments can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium and includes several instructions to make a device ( It may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, removable hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes.

本领域的普通技术人员可以理解,上述各实施方式是实现本发明的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本发明的精神和范围。Those of ordinary skill in the art can understand that the above-mentioned embodiments are specific examples for realizing the present invention, and in practical applications, various changes in form and details can be made without departing from the spirit and the spirit of the present invention. scope.

本领域的普通技术人员可以理解,上述各实施方式是实现本发明的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本发明的精神和范围。Those skilled in the art can understand that the above-mentioned embodiments are specific examples for realizing the present invention, and in practical applications, various changes in form and details can be made without departing from the spirit and the spirit of the present invention. scope.

Claims (9)

1.一种通信方法,其特征在于,包括:1. a communication method, is characterized in that, comprises: 获取至少M个地址,其中,M≧2;Obtain at least M addresses, where M≧2; 在第一预设时长内,分别且同时查找与所述M个地址中每个地址可通信的节点;Within a first preset time period, separately and simultaneously search for nodes that can communicate with each of the M addresses; 从所述M个地址中选定一个节点数量大于第一阈值的地址作为第一发送地址,向与所述第一发送地址可通信的多个第一节点发送第一待传输信息,并获取所述多个第一节点返回所述第一发送地址的第一回复信息,所述第一发送地址为终端发送所述第一待传输信息所使用的地址。Select an address with a number of nodes greater than the first threshold from the M addresses as the first sending address, send the first information to be transmitted to multiple first nodes that can communicate with the first sending address, and obtain all the addresses to be transmitted. The multiple first nodes return first reply information of the first sending address, where the first sending address is an address used by the terminal to send the first information to be transmitted. 2.根据权利要求1所述的通信方法,其特征在于,所述在第一预设时长内,分别且同时查找与所述M个地址中每个地址可通信的节点之后,还包括:2. The communication method according to claim 1, wherein, after searching for nodes that can communicate with each of the M addresses respectively and simultaneously within the first preset time period, the method further comprises: 将所述M个地址中每个地址分别与查找到的与其可通信的节点进行关联并保存;Associating and saving each of the M addresses with the found node that can communicate with it; 所述获取所述多个第一节点返回的第一回复信息之后,还包括:After the acquiring the first reply information returned by the multiple first nodes, the method further includes: 从所述M个地址中选定另一个节点数量大于第一阈值的地址作为第二发送地址,并获取与所述第二发送地址关联的多个第二节点;Select another address whose number of nodes is greater than the first threshold from the M addresses as the second sending address, and acquire a plurality of second nodes associated with the second sending address; 向所述多个第二节点发送第二待传输信息,并获取所述多个第二节点返回所述第二发送地址的第二回复信息。Send second information to be transmitted to the plurality of second nodes, and obtain second reply information returned by the plurality of second nodes to the second sending address. 3.根据权利要求1所述的通信方法,其特征在于,所述在第一预设时长内,分别且同时查找与M个地址中每个地址可通信的节点之后,还包括:3. The communication method according to claim 1, characterized in that, after searching for a node that can communicate with each of the M addresses respectively and simultaneously within the first preset duration, the method further comprises: 将所述M个地址中节点数量大于第一阈值的地址进行标记;marking the addresses whose number of nodes is greater than the first threshold in the M addresses; 将所述M个地址中被标记的地址分别与查找到的与其可通信的节点进行关联并保存;Associating and saving the marked addresses in the M addresses with the found nodes that can communicate with them respectively; 所述从所述M个地址中选定一个节点数量大于第一阈值的地址作为第一发送地址,具体为:The selecting an address whose number of nodes is greater than the first threshold is selected from the M addresses as the first sending address, specifically: 从所述被标记的地址中选定一个地址作为所述第一发送地址。An address is selected from the marked addresses as the first sending address. 4.根据权利要求3所述的通信方法,其特征在于,所述获取所述多个第一节点返回的第一回复信息之后,还包括:4. The communication method according to claim 3, wherein after acquiring the first reply information returned by the plurality of first nodes, the method further comprises: 从所述被标记的地址中选定另一个地址作为第二发送地址,并获取与所述第二发送地址关联的多个第二节点;Selecting another address from the marked addresses as the second sending address, and acquiring a plurality of second nodes associated with the second sending address; 向所述多个第二节点发送第二待传输信息,并获取所述多个第二节点返回所述第二发送地址的第二回复信息。Send second information to be transmitted to the plurality of second nodes, and obtain second reply information returned by the plurality of second nodes to the second sending address. 5.根据权利要求2或4任一项所述的通信方法,其特征在于,选定所述第二发送地址之后,还包括:5. The communication method according to any one of claims 2 or 4, wherein after selecting the second sending address, the method further comprises: 获取所述M个地址中剩余的节点数量大于第一阈值的地址的地址数量;Acquire the number of addresses of addresses where the number of nodes remaining in the M addresses is greater than the first threshold; 若所述地址数量小于第二阈值,则在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点,其中,所述P个地址与所述M个地址不重叠。If the number of addresses is less than the second threshold, within a second preset period of time, separately and simultaneously search for nodes that can communicate with each of the P addresses, where the P addresses and the M addresses are different from each other. overlapping. 6.根据权利要求5所述的通信方法,其特征在于,所述获取至少M个地址,具体为:至少获取所述M个地址和所述P个地址。6 . The communication method according to claim 5 , wherein the acquiring at least M addresses is specifically: acquiring at least the M addresses and the P addresses. 7 . 7.根据权利要求5所述的通信方法,其特征在于,所述获取至少M个地址,具体为:7. The communication method according to claim 5, wherein the acquiring at least M addresses is specifically: 获取所述M个地址;obtain the M addresses; 所述在第二预设时长内,分别且同时查找与P个地址中每个地址可通信的节点之前,还包括:Before searching for nodes that can communicate with each of the P addresses respectively and simultaneously within the second preset time period, the method further includes: 获取所述P个地址,其中,P≧2。Obtain the P addresses, where P≧2. 8.一种终端,其特征在于,包括:8. A terminal, characterized in that, comprising: 至少一个处理器;以及,at least one processor; and, 与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein, 所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至7中任一所述的通信方法。The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform any one of claims 1 to 7 communication method. 9.一种计算机可读存储介质,存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的通信方法。9 . A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the communication method according to any one of claims 1 to 7 is implemented. 10 .
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 北京航空航天大学 Peer-to-peer network super node selection and resource search method introducing node importance
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 system and its control method
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 北京航空航天大学 Peer-to-peer network super node selection and resource search method introducing node importance
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
JP6643760B2 (en) Short link processing method, device, and server
US20070233832A1 (en) Method of distributed hash table node ID collision detection
US8959193B2 (en) Group management device
CN111338806B (en) Service control method and device
US8903972B2 (en) Method and apparatus for sharing contents using information of group change in content oriented network environment
US20180013610A1 (en) File delivery method, apparatus and system
CN110855627B (en) Application deployment method, device, equipment and medium
EP2747336A1 (en) Content processing method, device and system
US9755833B2 (en) Identification information management system, method of generating and managing identification information, terminal, and generation and management programs
CN102891872A (en) Method and system for storing and searching data in peer to peer (P2P) network
WO2021218984A1 (en) Data routing method and related apparatus
CN109617817B (en) Method and device for generating forwarding table entry of MLAG networking
CN110932980B (en) Communication method, terminal, and computer-readable storage medium
JP6233846B2 (en) Variable-length nonce generation
US8688766B2 (en) Method for managing the allocation of data into a peer-to-peer network and peer implementing such method
CN116760762B (en) Decentralised ad hoc network method and device
CN111200640A (en) Client-based upload method and client
CN108632125B (en) Multicast table item management method, device, equipment and machine readable storage medium
CN110888892A (en) Block synchronization method, device and storage medium
CN111064774B (en) Distributed data storage method and device
CN104756465B (en) A kind of method for routing, equipment and system
CN108418709B (en) Port aggregation method and device
CN113015155B (en) eSIM server discovery method and device
CN101040506B (en) Method for initializing a peer-to-peer data network
KR100931201B1 (en) Intelligent Broker Device in Search System and Search Method Using the Same

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
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.

CB02 Change of applicant information
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.

GR01 Patent grant
GR01 Patent grant
PP01 Preservation of patent right
PP01 Preservation of patent right

Effective date of registration: 20250909

Granted publication date: 20220920