CN106028469B - Communication connection establishment method and device and mobile terminal - Google Patents
Communication connection establishment method and device and mobile terminal Download PDFInfo
- Publication number
- CN106028469B CN106028469B CN201610599306.2A CN201610599306A CN106028469B CN 106028469 B CN106028469 B CN 106028469B CN 201610599306 A CN201610599306 A CN 201610599306A CN 106028469 B CN106028469 B CN 106028469B
- Authority
- CN
- China
- Prior art keywords
- server
- network identifier
- communication connection
- network
- speaker
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/11—Allocation or use of connection identifiers
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Telephonic Communication Services (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
Description
技术领域technical field
本发明涉及终端技术领域,具体涉及一种通信连接建立方法、装置及移动终端。The present invention relates to the technical field of terminals, in particular to a communication connection establishment method, device and mobile terminal.
背景技术Background technique
在过去的音箱行业里,传统音箱类产品的创新遭遇极大瓶颈。而随着智能音箱的出现,使整个音箱行业迎来了第二春。In the past speaker industry, the innovation of traditional speaker products encountered a great bottleneck. With the emergence of smart speakers, the entire speaker industry has ushered in the second spring.
智能手机等终端连接智能音箱时,通过向网络中发送广播包来搜索智能音箱,智能音箱收到广播包后向终端发送服务器的IP地址和端口号,终端再根据该IP(InternetProtocol Address,互联网协议地址)地址和端口号找到对应的服务器,通过服务器与该智能音箱建立连接。在此过程中,终端向网络中发送的广播包是基于UDP(UserDatagramProtocol,用户数据报协议)协议的,而UDP协议具有不可靠性,因此可能会导致广播包丢失,这样智能音箱无法接收广播包,从而需要花费较多时间来建立连接。When a terminal such as a smartphone is connected to a smart speaker, it searches for the smart speaker by sending a broadcast packet to the network. After receiving the broadcast packet, the smart speaker sends the IP address and port number of the server to the terminal. address) address and port number to find the corresponding server, and establish a connection with the smart speaker through the server. In this process, the broadcast packets sent by the terminal to the network are based on the UDP (UserDatagramProtocol, User Datagram Protocol) protocol, and the UDP protocol is unreliable, so the broadcast packets may be lost, so that the smart speaker cannot receive the broadcast packets. , which takes more time to establish a connection.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供一种通信连接建立方法、装置及移动终端,可以解决现有的因广播包丢失导致音箱无法与终端快速连接的技术问题。Embodiments of the present invention provide a method, device and mobile terminal for establishing a communication connection, which can solve the existing technical problem that the speaker cannot be quickly connected to the terminal due to the loss of broadcast packets.
本发明实施例提供一种通信连接建立方法,包括:An embodiment of the present invention provides a method for establishing a communication connection, including:
获取当前网络的网络标识;Get the network ID of the current network;
根据所述网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;According to the network identifier, obtain the first server network identifier from the historical server network identifier collection;
获取所述第一服务器网络标识对应的第一服务器;obtaining the first server corresponding to the network identifier of the first server;
通过所述第一服务器,与所述第一服务器对应的第一音箱建立通信连接。A communication connection is established with the first speaker corresponding to the first server through the first server.
优选的,所述根据所述网络标识,从历史服务器网络标识集合中获取第一服务器网络标识的步骤之前还包括:Preferably, before the step of obtaining the network identifier of the first server from the set of network identifiers of historical servers according to the network identifier, the step further includes:
通过当前网络发送第一消息;Send the first message through the current network;
获取第二音箱接收所述第一消息后返回的第二消息,其中所述第二消息包含第二服务器网络标识。Acquire a second message returned by the second speaker after receiving the first message, where the second message includes the network identifier of the second server.
优选的,所述根据所述网络标识,从历史服务器网络标识集合中获取第一服务器网络标识的步骤具体包括:Preferably, the step of acquiring the network identifier of the first server from the set of network identifiers of historical servers according to the network identifier specifically includes:
判断所述历史服务器网络标识集合中是否存在与所述网络标识处于相同网段的目标服务器网络标识;Judging whether there is a target server network identifier in the same network segment as the network identifier in the historical server network identifier set;
如存在,则将所述目标服务器网络标识设置为第一服务器网络标识,并获取所述第一服务器网络标识;If there is, set the target server network identifier as the first server network identifier, and obtain the first server network identifier;
如不存在,则获取所述第二服务器网络标识;If it does not exist, obtain the network identifier of the second server;
优选的,所述获取所述第二服务器网络标识的步骤之后还包括:Preferably, after the step of acquiring the network identifier of the second server, the step further includes:
获取所述第二服务器网络标识对应的第二服务器;obtaining a second server corresponding to the network identifier of the second server;
通过所述第二服务器,与所述第二音箱建立通信连接。A communication connection is established with the second speaker through the second server.
优选的,所述通过所述第二服务器,与所述第二音箱建立通信连接的步骤之后还包括:Preferably, the step of establishing a communication connection with the second speaker through the second server further includes:
将所述第二服务器网络标识添加到所述历史服务器网络标识集合中。The second server network identifier is added to the set of historical server network identifiers.
本发明实施例还提供了一种通信连接建立装置,包括:The embodiment of the present invention also provides a communication connection establishment device, including:
第一标识获取模块,用于获取当前网络的网络标识;a first identification obtaining module, used for obtaining the network identification of the current network;
第二标识获取模块,用于根据所述网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;A second identification obtaining module, configured to obtain the first server network identification from the historical server network identification collection according to the network identification;
服务器获取模块,用于获取所述第一服务器网络标识对应的第一服务器;A server acquisition module, configured to acquire the first server corresponding to the network identifier of the first server;
连接模块,用于通过所述第一服务器,与所述第一服务器对应的第一音箱建立通信连接。The connection module is configured to establish a communication connection with the first speaker corresponding to the first server through the first server.
优选的,所述通信连接装置还包括:Preferably, the communication connection device further includes:
发送模块,用于通过当前网络发送第一消息;a sending module, configured to send the first message through the current network;
获取模块,用于获取第二音箱接收所述第一消息后返回的第二消息,其中所述第二消息包含第二服务器网络标识。an obtaining module, configured to obtain a second message returned by the second speaker after receiving the first message, wherein the second message includes a network identifier of the second server.
优选的,所述第二标识获取模块包括:Preferably, the second identification acquisition module includes:
判断子模块,用于判断所述历史服务器网络标识集合中是否存在与所述网络标识处于相同网段的目标服务器网络标识;A judging submodule for judging whether there is a target server network identifier in the same network segment as the network identifier in the historical server network identifier set;
第一获取子模块,用于在存在时,则将所述目标服务器网络标识设置为第一服务器网络标识,并获取所述第一服务器网络标识;a first acquiring submodule, configured to set the target server network identifier as the first server network identifier when it exists, and acquire the first server network identifier;
第二获取子模块,用于在不存在时,则获取所述第二服务器网络标识;a second obtaining submodule, configured to obtain the network identifier of the second server when it does not exist;
优选的,所述第二获取子模块具体用于:Preferably, the second acquisition submodule is specifically used for:
获取所述第二服务器网络标识对应的第二服务器;obtaining a second server corresponding to the network identifier of the second server;
通过所述第二服务器,与所述第二音箱建立通信连接。A communication connection is established with the second speaker through the second server.
发明实施例还提供了一种移动终端,包括上述通信连接建立装置。An embodiment of the invention also provides a mobile terminal, including the above-mentioned apparatus for establishing a communication connection.
本发明实施例采用采用获取当前网络的网络标识;根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;获取第一服务器网络标识对应的第一服务器;通过第一服务器,与第一服务器对应的第一音箱建立通信连接。该方案通过查找曾帮助过终端与音箱建立通信连接的服务器,并选取相应的服务器继续建立通信连接,相对现有技术而言,可以提高终端与音箱建立通信连接的速度。The embodiment of the present invention adopts and obtains the network identifier of the current network; according to the network identifier, the network identifier of the first server is obtained from the network identifier collection of historical servers; the first server corresponding to the network identifier of the first server is acquired; A first speaker corresponding to a server establishes a communication connection. This solution can improve the speed of establishing a communication connection between the terminal and the speaker by searching for a server that has helped the terminal to establish a communication connection with the speaker, and selecting the corresponding server to continue establishing the communication connection.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
图1为本发明的通信连接建立方法的第一优选实施例的流程图;1 is a flow chart of a first preferred embodiment of a method for establishing a communication connection of the present invention;
图2为本发明的通信连接建立方法的第二优选实施例的流程图;2 is a flowchart of a second preferred embodiment of the method for establishing a communication connection of the present invention;
图3为本发明的通信连接建立装置的优选实施例的结构图;FIG. 3 is a structural diagram of a preferred embodiment of the device for establishing a communication connection according to the present invention;
图4为本发明的移动终端的优选实施例的结构图;4 is a structural diagram of a preferred embodiment of the mobile terminal of the present invention;
图5为本发明的通信连接建立方法、装置及移动终端的具体实施例的流程图。FIG. 5 is a flow chart of specific embodiments of the method, apparatus and mobile terminal for establishing a communication connection according to the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
本发明实施例提供一种通信连接建立方法、装置和移动终端。以下将分别进行详细说明。Embodiments of the present invention provide a method, device and mobile terminal for establishing a communication connection. The detailed descriptions will be given below.
实施例一、Embodiment 1.
请参照图1,图1为本发明的通信连接建立方法的第一优选实施例的流程图。该方法用于终端与音箱建立通信连接,其中该终端可以是智能手机、平板电脑等移动设备。本优选实施例的通信连接建立方法包括:Please refer to FIG. 1 , which is a flowchart of a first preferred embodiment of a method for establishing a communication connection of the present invention. The method is used for establishing a communication connection between a terminal and a speaker, wherein the terminal may be a mobile device such as a smart phone and a tablet computer. The method for establishing a communication connection in this preferred embodiment includes:
步骤S101,获取当前网络的网络标识;Step S101, obtaining the network identifier of the current network;
步骤S102,根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;Step S102, according to the network identifier, obtain the first server network identifier from the historical server network identifier collection;
步骤S103,获取第一服务器网络标识对应的第一服务器;Step S103, obtaining the first server corresponding to the network identifier of the first server;
步骤S104,通过第一服务器,与第一服务器对应的第一音箱建立通信连接。Step S104, through the first server, establish a communication connection with the first speaker corresponding to the first server.
下面详细说明本优选实施例的通信连接建立方法的各步骤的具体流程。The specific flow of each step of the communication connection establishment method of the present preferred embodiment will be described in detail below.
在步骤S101中,终端获取当前网络的网络标识。其中当前网络的网络标识,用于唯一标识终端当前所处的网络,如IP(Internet ProtocolAddress,互联网协议地址)地址、MAC(MediaAccess Control,物理地址)地址等。In step S101, the terminal acquires the network identifier of the current network. The network identifier of the current network is used to uniquely identify the network where the terminal is currently located, such as an IP (Internet Protocol Address, Internet Protocol Address) address, a MAC (Media Access Control, physical address) address, and the like.
在现有技术中,终端与智能音箱建立通信连接的过程中是以广播形式发送消息,该消息是基于UDP(User Datagram Protocol,用户数据报协议)协议的,而UDP协议为不可靠协议,因此会造成消息丢失的情况,尤其是网络状况不佳时消息丢失情况更严重,终端需要花费较长时间连接智能音箱。In the prior art, in the process of establishing a communication connection between a terminal and a smart speaker, a message is sent in the form of broadcast, and the message is based on the UDP (User Datagram Protocol, User Datagram Protocol) protocol, and the UDP protocol is an unreliable protocol, so It will cause message loss, especially when the network condition is not good, the message loss is more serious, and it takes a long time for the terminal to connect to the smart speaker.
为了解决以上问题,本优选实施例在获取当前网络的网络标识的基础上,再根据一定规则其来查找对应的服务器网络标识,进而找到可以帮助终端与智能音箱建立通信连接的服务器,以提高建立通信连接的速度。随后转入步骤S102。In order to solve the above problems, on the basis of obtaining the network identifier of the current network, this preferred embodiment searches for the corresponding server network identifier according to certain rules, and then finds a server that can help the terminal to establish a communication connection with the smart speaker, so as to improve the establishment of The speed of the communication connection. Then it goes to step S102.
在步骤S102中,终端根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识。其中,第一服务器网络标识为服务器在网络中的标识信息,包括IP地址、MAC地址等,每个第一服务器网络标识都唯一对应一个服务器。历史服务器网络标识集合包括曾与终端建立过通信连接的服务器网络标识,由于人们往往使用智能音箱的场所较为固定,因此查找历史服务器网络标识较快捷。随后转入步骤S103。In step S102, the terminal acquires the network identifier of the first server from a set of network identifiers of historical servers according to the network identifier. Wherein, the first server network identification is identification information of the server in the network, including IP address, MAC address, etc., and each first server network identification uniquely corresponds to a server. The set of historical server network identifiers includes server network identifiers that have established a communication connection with the terminal. Since people tend to use smart speakers in relatively fixed places, it is faster to search for historical server network identifiers. Then it goes to step S103.
在步骤S103中,由于每个第一服务器网络标识都对应一个服务器,因此终端获取该第一服务器网络标识对应的第一服务器。随后转入步骤S104.=。In step S103, since each network identifier of the first server corresponds to a server, the terminal acquires the first server corresponding to the network identifier of the first server. Then go to step S104.=.
在步骤S104中,终端通过第一服务器,登陆该第一服务器对应的第一音箱,从而与第一音箱建立通信连接,进而可以控制第一音箱的音乐播放、收音等功能。In step S104, the terminal logs in to the first speaker corresponding to the first server through the first server, thereby establishing a communication connection with the first speaker, and then controlling the functions of the first speaker such as music playback and radio.
本发明的通信连接建立方法采用获取当前网络的网络标识;根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;获取第一服务器网络标识对应的第一服务器;通过第一服务器,与第一服务器对应的第一音箱建立通信连接。该方案通过查找曾帮助过终端与音箱建立通信连接的服务器,并选取相应的服务器继续建立通信连接,从而提高了与音箱建立通信连接的速度。The communication connection establishment method of the present invention adopts acquiring the network identifier of the current network; obtaining the first server network identifier from the historical server network identifier set according to the network identifier; acquiring the first server corresponding to the first server network identifier; through the first server, A communication connection is established with the first speaker corresponding to the first server. The solution improves the speed of establishing a communication connection with the speaker by searching for the server that has helped the terminal to establish a communication connection with the speaker, and selecting the corresponding server to continue establishing the communication connection.
实施例二、Embodiment two,
请参照图2,图2为本发明的通信连接建立方法的第二优选实施例的流程图。该方法用于终端与智能音箱建立通信连接,其中该终端可以是智能手机、平板电脑等移动设备。本优选实施例的通信连接建立方法包括:Please refer to FIG. 2 , which is a flowchart of a second preferred embodiment of a method for establishing a communication connection of the present invention. The method is used for establishing a communication connection between a terminal and a smart speaker, wherein the terminal may be a mobile device such as a smart phone or a tablet computer. The method for establishing a communication connection in this preferred embodiment includes:
步骤S201,获取当前网络的网络标识;通过当前网络发送第一消息;获取第二音箱接收第一消息后返回的第二消息,其中第二消息包含第二服务器网络标识;Step S201, obtaining the network identifier of the current network; sending the first message through the current network; obtaining the second message returned by the second speaker after receiving the first message, wherein the second message includes the second server network identifier;
步骤S202,判断历史服务器网络标识集合中是否存在与网络标识处于相同网段的目标服务器网络标识;Step S202, judging whether there is a target server network identifier in the same network segment as the network identifier in the historical server network identifier set;
步骤S203,如存在,则将目标服务器网络标识设置为第一服务器网络标识,并获取第一服务器网络标识;获取第一服务器网络标识对应的第一服务器;通过第一服务器,与第一服务器对应的第一音箱建立通信连接。Step S203, if there is, set the target server network identifier as the first server network identifier, and obtain the first server network identifier; acquire the first server corresponding to the first server network identifier; through the first server, correspond to the first server the first speaker to establish a communication connection.
步骤S204,如不存在,则获取第二服务器网络标识;获取第二服务器网络标识对应的第二服务器;通过第二服务器,与第二音箱建立通信连接;Step S204, if it does not exist, obtain the network identifier of the second server; obtain the second server corresponding to the network identifier of the second server; establish a communication connection with the second speaker through the second server;
步骤S205,将第二服务器网络标识添加到历史服务器网络标识集合中。Step S205, adding the second server network identifier to the historical server network identifier set.
下面详细说明本优选实施例的通信连接建立方法的各步骤的具体流程。The specific flow of each step of the communication connection establishment method of the present preferred embodiment will be described in detail below.
在步骤S201,终端获取当前网络的网络标识;通过当前网络发送第一消息;获取第二音箱接收第一消息后返回的第二消息,其中第二消息包含第二服务器网络标识。In step S201, the terminal obtains the network identifier of the current network; sends the first message through the current network; obtains the second message returned by the second speaker after receiving the first message, wherein the second message includes the second server network identifier.
其中当前网络的网络标识,用于唯一标识终端当前所处的网络,如IP(InternetProtocol Address,互联网协议地址)地址、MAC(Media Access Control,物理地址)地址等。第二服务器网络标识为服务器在网络中的标识信息,同理包括IP地址、MAC地址等。通常情况下,终端和智能音箱之间通过http(HyperText Transfer Protocol,超文本传输协议)服务器建立通信连接,如终端中的应用登陆连接智能音箱,从智能音箱中获取状态数据等,因此有必要获取http服务器网络标识。The network identifier of the current network is used to uniquely identify the network where the terminal is currently located, such as an IP (Internet Protocol Address, Internet Protocol Address) address, a MAC (Media Access Control, physical address) address, and the like. The second server network identification is identification information of the server in the network, and similarly includes an IP address, a MAC address, and the like. Usually, a communication connection is established between the terminal and the smart speaker through the http (HyperText Transfer Protocol) server. For example, the application in the terminal is logged in to connect to the smart speaker, and the status data is obtained from the smart speaker. Therefore, it is necessary to obtain http server network ID.
在现有技术中,终端通过当前所处的网络,以广播的形式给与终端处于同一网络中的智能音箱发送请求连接消息,请求与智能音箱建立通信连接;智能音箱接收到该消息后,将返回答应连接消息,该答应连接消息中携带了服务器网络标识;终端接收到答应连接消息后,可以根据服务器网络标识查找到对应的服务器;最后,终端再通过该服务器来与智能音箱建立通信连接。上述终端与智能音箱建立通信连接的过程中,由于以广播形式发送的消息是基于UDP(User Datagram Protocol,用户数据报协议)协议的,且UDP协议为不可靠协议,因此该过程中会造成消息丢失的情况,尤其是网络状况不佳时消息丢失情况更严重,终端需要花费较长时间连接智能音箱。In the prior art, the terminal sends a connection request message to the smart speaker in the same network as the terminal through the current network, in the form of broadcast, requesting to establish a communication connection with the smart speaker; after the smart speaker receives the message, it sends a message to the smart speaker. The connection permission message is returned, and the connection permission message carries the server network identifier; after the terminal receives the connection permission message, it can find the corresponding server according to the server network identifier; finally, the terminal establishes a communication connection with the smart speaker through the server. In the process of establishing a communication connection between the above-mentioned terminal and the smart speaker, because the message sent in the form of broadcast is based on the UDP (User Datagram Protocol, User Datagram Protocol) protocol, and the UDP protocol is an unreliable protocol, so this process will cause messages. In the case of loss, especially when the network condition is poor, the loss of messages is more serious, and the terminal takes a long time to connect to the smart speaker.
为了解决以上问题,在本优选实施例中采取了通过获取当前网络的网络标识,再根据一定规则其来查找对应的服务器网络标识,进而找到可以帮助终端与智能音箱建立通信连接的服务器的第一方案,以提高建立通信连接的速度。其中,具体的查找方法在步骤S202给出。In order to solve the above problems, in this preferred embodiment, the first method is to obtain the network identifier of the current network, and then search for the corresponding server network identifier according to certain rules, and then find the server that can help the terminal to establish a communication connection with the smart speaker. scheme to increase the speed of establishing a communication connection. The specific search method is given in step S202.
在获取当前网络的网络标识的同时,终端仍采取了以广播形式通过当前网络发送第一消息以查找第二服务器网络标识的第二方案,在该方案中第二音箱接收第一消息后将返回第二消息,该第二消息中携带了第二服务器网络标识,终端获取到返回的第二消息后,自然就得到了第二服务器网络标识。上述第一方案和第二方案共同确保了终端快速与智能音箱建立连接。随后转入步骤S202。While acquiring the network identifier of the current network, the terminal still adopts the second solution of sending the first message through the current network in the form of broadcast to find the network identifier of the second server. In this solution, the second speaker will return the first message after receiving the first message. In the second message, the second message carries the network identifier of the second server. After acquiring the returned second message, the terminal naturally obtains the network identifier of the second server. The first solution and the second solution above jointly ensure that the terminal quickly establishes a connection with the smart speaker. Then go to step S202.
在步骤S202中,终端判断历史服务器网络标识集合中是否存在与网络标识处于相同网段的目标服务器网络标识,如存在,则转入步骤S203;如不存在,则转入步骤S206。In step S202, the terminal determines whether there is a target server network identifier in the same network segment as the network identifier in the historical server network identifier set, if so, go to step S203; if not, go to step S206.
需要说明的是,网段一般指一个计算机网络中使用同一物理层设备(传输介质、中继器、集线器等)能够直接通讯的那一部分,因此要查找与该网络标识处于相同网段的目标服务器。其中,历史服务器网络标识集合包括曾与终端建立过通信连接的服务器网络标识,由于人们往往使用智能音箱的场所较为固定,因此查找历史服务器网络标识较快捷。It should be noted that the network segment generally refers to the part of a computer network that can communicate directly using the same physical layer device (transmission medium, repeater, hub, etc.). Therefore, it is necessary to find the target server in the same network segment as the network identifier. . Among them, the set of historical server network identifiers includes server network identifiers that have established a communication connection with the terminal. Since people often use smart speakers in relatively fixed places, it is faster to search for historical server network identifiers.
在步骤S203中,如存在,则终端通过该目标服务器网络标识来找到可以帮助终端与智能音箱建立通信连接的目标服务器。具体的,终端先将目标服务器网络标识设置为第一服务器网络标识,并获取该第一服务器网络标识;然后再获取第一服务器网络标识对应的第一服务器;最后通过第一服务器,与第一服务器对应的第一音箱建立通信连接。这样终端可以快速的与智能音箱建立通信连接。In step S203, if there is, the terminal finds a target server that can help the terminal to establish a communication connection with the smart speaker through the target server network identifier. Specifically, the terminal first sets the target server network identifier as the first server network identifier, and acquires the first server network identifier; then acquires the first server corresponding to the first server network identifier; and finally, through the first server, communicates with the first server network identifier. The first speaker corresponding to the server establishes a communication connection. In this way, the terminal can quickly establish a communication connection with the smart speaker.
需要说明的是,当终端正在与第一服务器建立通信连接,或已与第一服务器建立了通信连接,那么终端无需理会步骤S201中获取到的第二消息。It should be noted that, when the terminal is establishing a communication connection with the first server, or has established a communication connection with the first server, the terminal does not need to pay attention to the second message acquired in step S201.
在步骤S204中,如不存在,则终端执行第二方案。具体的,终端首先获取第二服务器网络标识;接着获取第二服务器网络标识对应的第二服务器;最后通过第二服务器,与第二音箱建立通信连接。这样进一步保证了终端能快速的与智能音箱建立通信连接。随后转入步骤S205。In step S204, if it does not exist, the terminal executes the second solution. Specifically, the terminal first acquires the network identifier of the second server; then acquires the second server corresponding to the network identifier of the second server; and finally establishes a communication connection with the second speaker through the second server. This further ensures that the terminal can quickly establish a communication connection with the smart speaker. Then it goes to step S205.
在步骤S205中,由于第二服务器能帮助终端与智能音箱建立通信连接,因此可以将该第二服务器对应的第二服务器网络标识添加到历史服务器网络标识集合中,以便于终端下次优选选择该第二服务器进行通信连接。In step S205, since the second server can help the terminal to establish a communication connection with the smart speaker, the second server network identifier corresponding to the second server can be added to the historical server network identifier set, so that the terminal can select the The second server is in communication connection.
以上即本优选实施例的通信连接建立方法对终端与智能音箱建立通信连接的全过程。The above is the whole process of establishing a communication connection between a terminal and a smart speaker by the method for establishing a communication connection in this preferred embodiment.
本发明的通信连接建立方法采用获取当前网络的网络标识;通过当前网络发送第一消息;获取第二音箱接收第一消息后返回的第二消息,其中第二消息包含第二服务器网络标识;判断历史服务器网络标识集合中是否存在与网络标识处于相同网段的目标服务器网络标识;如存在,则将目标服务器网络标识设置为第一服务器网络标识,并获取第一服务器网络标识;获取第一服务器网络标识对应的第一服务器;通过第一服务器,与第一服务器对应的第一音箱建立通信连接。如不存在,则获取第二服务器网络标识;获取第二服务器网络标识对应的第二服务器;通过第二服务器,与第二音箱建立通信连接;将第二服务器网络标识添加到历史服务器网络标识集合中。该方案通过查找曾帮助过终端与音箱建立通信连接的服务器,并选取相应的服务器继续建立通信连接,从而提高了与音箱建立通信连接的速度。同时还通过当前网络发送广播消息来与音箱建立通信连接,进一步保确保了通信连接建立的成功率。The method for establishing a communication connection of the present invention adopts acquiring the network identifier of the current network; sending the first message through the current network; acquiring the second message returned by the second speaker after receiving the first message, wherein the second message includes the network identifier of the second server; Whether there is a target server network identifier in the same network segment as the network identifier in the historical server network identifier set; if there is, set the target server network identifier as the first server network identifier, and obtain the first server network identifier; Obtain the first server network identifier The first server corresponding to the network identifier; through the first server, a communication connection is established with the first speaker corresponding to the first server. If it does not exist, then acquire the second server network identifier; acquire the second server corresponding to the second server network identifier; establish a communication connection with the second speaker through the second server; add the second server network identifier to the historical server network identifier set middle. The solution improves the speed of establishing a communication connection with the speaker by searching for the server that has helped the terminal to establish a communication connection with the speaker, and selecting the corresponding server to continue establishing the communication connection. At the same time, a broadcast message is sent through the current network to establish a communication connection with the speaker, which further ensures the success rate of the establishment of the communication connection.
实施例三、Embodiment three,
为了更好地实施以上方法,本发明实施例还提供一种通信连接建立装置,该通信连接建立装置可以集成在终端中,该终端具体可以是智能手机、平板电脑等设备。如图3所示,该通信连接建立装置30包括第一标识获取模块301、第二标识获取模块302、服务器获取模块303和连接模块304。具体描述如下:In order to better implement the above method, an embodiment of the present invention further provides a communication connection establishment apparatus, which may be integrated in a terminal, and the terminal may specifically be a device such as a smart phone or a tablet computer. As shown in FIG. 3 , the communication connection establishment device 30 includes a first identification acquisition module 301 , a second identification acquisition module 302 , a server acquisition module 303 and a connection module 304 . The specific description is as follows:
第一标识获取模块301,用于获取当前网络的网络标识;The first identification obtaining module 301 is used to obtain the network identification of the current network;
第二标识获取模块302,用于根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;The second identification obtaining module 302 is configured to obtain the first server network identification from the historical server network identification collection according to the network identification;
服务器获取模块303,用于获取第一服务器网络标识对应的第一服务器;A server obtaining module 303, configured to obtain the first server corresponding to the network identifier of the first server;
连接模块304,用于通过第一服务器,与第一服务器对应的第一音箱建立通信连接。The connection module 304 is configured to establish a communication connection with the first speaker corresponding to the first server through the first server.
进一步的,通信连接装置还包括发送模块305和获取模块306。具体描述如下:Further, the communication connection apparatus further includes a sending module 305 and an obtaining module 306 . The specific description is as follows:
发送模块305,用于通过当前网络发送第一消息;a sending module 305, configured to send the first message through the current network;
获取模块306,用于获取第二音箱接收第一消息后返回的第二消息,其中第二消息包含第二服务器网络标识。The obtaining module 306 is configured to obtain a second message returned by the second speaker after receiving the first message, where the second message includes the network identifier of the second server.
进一步的,第二标识获取模块302包括判断子模块、第一获取子模块和第二获取子模块。具体描述如下:Further, the second identification obtaining module 302 includes a judgment sub-module, a first obtaining sub-module and a second obtaining sub-module. The specific description is as follows:
判断子模块,用于判断历史服务器网络标识集合中是否存在与网络标识处于相同网段的目标服务器网络标识;A judging submodule for judging whether there is a target server network identifier in the same network segment as the network identifier in the historical server network identifier set;
第一获取子模块,用于在存在时,则将目标服务器网络标识设置为第一服务器网络标识,并获取第一服务器网络标识;a first acquisition submodule, configured to set the target server network identifier as the first server network identifier when it exists, and acquire the first server network identifier;
第二获取子模块,用于在不存在时,则获取第二服务器网络标识;The second acquisition submodule is used to acquire the network identifier of the second server when it does not exist;
进一步的,第二获取子模块具体用于:Further, the second acquisition submodule is specifically used for:
获取第二服务器网络标识对应的第二服务器;obtaining the second server corresponding to the network identifier of the second server;
通过第二服务器,与第二音箱建立通信连接。A communication connection is established with the second speaker through the second server.
本发明的通信连接建立装置采用获取当前网络的网络标识;根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;获取第一服务器网络标识对应的第一服务器;通过第一服务器,与第一服务器对应的第一音箱建立通信连接。该方案通过查找曾帮助过终端与音箱建立通信连接的服务器,并选取相应的服务器继续建立通信连接,从而提高了与音箱建立通信连接的速度。The communication connection establishment device of the present invention adopts the network identification of the current network; obtains the first server network identification from the historical server network identification collection according to the network identification; obtains the first server corresponding to the first server network identification; through the first server, A communication connection is established with the first speaker corresponding to the first server. The solution improves the speed of establishing a communication connection with the speaker by searching for the server that has helped the terminal to establish a communication connection with the speaker, and selecting the corresponding server to continue establishing the communication connection.
实施例四、Embodiment four,
本发明实施例还提供一种移动终端,该移动终端包括如前文实施例三所述的通信连接建立装置。该通信连接建立装置可以用于执行本发明实施例一和实施例二提供的通信连接建立方法,其实现原理和技术效果类似,此处不再赘述。An embodiment of the present invention further provides a mobile terminal, where the mobile terminal includes the apparatus for establishing a communication connection as described in Embodiment 3 above. The communication connection establishment apparatus may be used to execute the communication connection establishment methods provided in Embodiment 1 and Embodiment 2 of the present invention, and the implementation principles and technical effects thereof are similar, and details are not described herein again.
相应的,参照附图4,图4为本发明实施例四提供的一种移动终端的结构示意图。该移动终端40至少包括一个处理器401,例如中央处理器(CPU,Central Processing Unit),至少一个网络接口402,用户接口403,存储器404和至少一个通信总线405。Correspondingly, referring to FIG. 4 , FIG. 4 is a schematic structural diagram of a mobile terminal according to Embodiment 4 of the present invention. The mobile terminal 40 includes at least one processor 401 , such as a central processing unit (CPU, Central Processing Unit), at least one network interface 402 , user interface 403 , memory 404 and at least one communication bus 405 .
其中,通信总线405用于实现处理器401,存储器404等组件之间的连接通信。网络接口402用于实现物理主机与网络之间的连接通信,如可以用于连接物理网卡和物理交换机等设备;用户接口403可以包括显示屏、键盘,同时用户接口403为无线接口,也可以为有线接口;存储器404可以是高速存储器,也可以是非不稳定的存储器。Among them, the communication bus 405 is used to realize the connection and communication between components such as the processor 401 and the memory 404 . The network interface 402 is used to realize the connection and communication between the physical host and the network, for example, it can be used to connect devices such as physical network cards and physical switches; the user interface 403 can include a display screen and a keyboard, and the user interface 403 is a wireless interface, or can be a Wired interface; memory 404 may be high-speed memory or non-volatile memory.
在一些实施方式中,存储器404还包括操作系统4041和应用模块4042。操作系统4041包含了各种系统程序,用于实现各种基础业务以及处理基于硬件的业务;应用模块4042包含各种应用程序,用于实现各种应用业务。In some embodiments, the memory 404 also includes an operating system 4041 and an application module 4042 . The operating system 4041 contains various system programs for implementing various basic services and processing hardware-based services; the application module 4042 contains various application programs for implementing various application services.
具体的,处理器401用于获取当前网络的网络标识;用于根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;用于获取第一服务器网络标识对应的第一服务器;用于通过第一服务器,与第一服务器对应的第一音箱建立通信连接。Specifically, the processor 401 is configured to acquire the network identifier of the current network; to acquire the first server network identifier from the set of historical server network identifiers according to the network identifier; to acquire the first server corresponding to the first server network identifier; A communication connection is established with the first speaker corresponding to the first server through the first server.
进一步的,处理器401用于通过当前网络发送第一消息;用于获取第二音箱接收第一消息后返回的第二消息,其中第二消息包含第二服务器网络标识。Further, the processor 401 is configured to send the first message through the current network; and is configured to acquire the second message returned by the second speaker after receiving the first message, where the second message includes the network identifier of the second server.
进一步的,处理器401用于判断历史服务器网络标识集合中是否存在与网络标识处于相同网段的目标服务器网络标识;用于在存在时,则将目标服务器网络标识设置为第一服务器网络标识,并获取第一服务器网络标识;用于在不存在时,则获取第二服务器网络标识;Further, the processor 401 is used for judging whether there is a target server network identifier in the same network segment as the network identifier in the historical server network identifier set; when it exists, the target server network identifier is set as the first server network identifier, and acquiring the network identifier of the first server; when it does not exist, acquiring the network identifier of the second server;
进一步的,处理器具体401用于获取第二服务器网络标识对应的第二服务器;通过第二服务器,与第二音箱建立通信连接。Further, the processor 401 is specifically configured to acquire the second server corresponding to the network identifier of the second server; establish a communication connection with the second speaker through the second server.
本发明的移动终端采用获取当前网络的网络标识;根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;获取第一服务器网络标识对应的第一服务器;通过第一服务器,与第一服务器对应的第一音箱建立通信连接。该方案通过查找曾帮助过终端与音箱建立通信连接的服务器,并选取相应的服务器继续建立通信连接,从而提高了与音箱建立通信连接的速度。The mobile terminal of the present invention obtains the network identifier of the current network; obtains the first server network identifier from the historical server network identifier collection according to the network identifier; acquires the first server corresponding to the first server network identifier; A first speaker corresponding to a server establishes a communication connection. The solution improves the speed of establishing a communication connection with the speaker by searching for the server that has helped the terminal to establish a communication connection with the speaker, and selecting the corresponding server to continue establishing the communication connection.
实施例五、Embodiment five,
请参照图5,图5为本发明的通信连接建立方法、装置及移动终端的具体实施例的流程图。其中,移动终端以手机为例。Please refer to FIG. 5 . FIG. 5 is a flowchart of specific embodiments of the method, device and mobile terminal for establishing a communication connection according to the present invention. The mobile terminal is a mobile phone as an example.
用户回到家,打开手机中的音乐播放应用,选取一首歌通过智能音箱播放。When the user returns home, he opens the music player application on his phone and selects a song to play through the smart speaker.
在步骤S501中,手机获取当前连接的网络的网络地址为192.168.0.12。于是从历史服务器网络地址集合中查找处于192.168.0.1-192.168.255.255网段的服务器网络地址。随后转入步骤S502。In step S501, the mobile phone obtains the network address of the currently connected network as 192.168.0.12. Then, the server network address in the 192.168.0.1-192.168.255.255 network segment is searched from the historical server network address set. Then it goes to step S502.
在步骤S502中,手机查找到处于192.168.0.1-192.168.255.255网段的服务器网络地址为192.168.254.12。于是手机通过该服务器网络地址192.168.254.12查找到第一服务器。随后转入步骤S502。In step S502, the mobile phone finds that the network address of the server in the network segment 192.168.0.1-192.168.255.255 is 192.168.254.12. Then the mobile phone finds the first server through the server network address 192.168.254.12. Then it goes to step S502.
在步骤S503中,手机查找到该第一服务器对应的音箱为第一音箱,于是通过该第一服务器与第一音箱建立通信连接,以播放音乐。In step S503, the mobile phone finds that the speaker corresponding to the first server is the first speaker, and then establishes a communication connection with the first speaker through the first server to play music.
本发明采用获取当前网络的网络标识;根据网络标识,从历史服务器网络标识集合中获取第一服务器网络标识;获取第一服务器网络标识对应的第一服务器;通过第一服务器,与第一服务器对应的第一音箱建立通信连接。该方案通过查找曾帮助过终端与音箱建立通信连接的服务器,并选取相应的服务器继续建立通信连接,从而提高了与音箱建立通信连接的速度。The present invention adopts acquiring the network identifier of the current network; obtaining the network identifier of the first server from the network identifier collection of historical servers according to the network identifier; acquiring the first server corresponding to the network identifier of the first server; through the first server, corresponding to the first server the first speaker to establish a communication connection. The solution improves the speed of establishing a communication connection with the speaker by searching for the server that has helped the terminal to establish a communication connection with the speaker, and selecting the corresponding server to continue establishing the communication connection.
具体实施时,以上各个模块可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现,以上各个模块的具体实施可参见前面的方法实施例,在此不再赘述。During specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above modules can refer to the previous method embodiments, which will not be repeated here.
需要说明的是,本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于计算机可读存储介质中,如存储在终端的存储器中,并被该终端内的至少一个处理器执行,在执行过程中可包括如信息发布方法的实施例的流程。其中,存储介质可以包括:只读存储器(ROM,Read OnlyMemory)、随机存取记忆体(RAM,RandomAccess Memory)、磁盘或光盘等。It should be noted that those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium, such as It is stored in the memory of the terminal and executed by at least one processor in the terminal, and the execution process may include the flow of the embodiment of the information publishing method. The storage medium may include: a read only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and the like.
以上对本发明实施例提供的一种通信连接建立方法和装置进行了详细介绍,其各功能模块可以集成在一个处理芯片中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。A method and apparatus for establishing a communication connection provided by the embodiments of the present invention have been described in detail above. Each functional module may be integrated in a processing chip, or each module may exist physically alone, or two or more modules may be used. integrated in one module. The above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules. The principles and implementations of the present invention are described herein using specific examples, and the descriptions of the above embodiments are only used to help understand the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the Thoughts, there will be changes in specific embodiments and application scopes. To sum up, the contents of this specification should not be construed as limiting the present invention.
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610599306.2A CN106028469B (en) | 2016-07-26 | 2016-07-26 | Communication connection establishment method and device and mobile terminal |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610599306.2A CN106028469B (en) | 2016-07-26 | 2016-07-26 | Communication connection establishment method and device and mobile terminal |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN106028469A CN106028469A (en) | 2016-10-12 |
| CN106028469B true CN106028469B (en) | 2019-08-06 |
Family
ID=57114753
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610599306.2A Active CN106028469B (en) | 2016-07-26 | 2016-07-26 | Communication connection establishment method and device and mobile terminal |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106028469B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110324229B (en) * | 2018-03-30 | 2022-04-12 | 武汉斗鱼网络科技有限公司 | Bullet screen server connection method, client and readable storage medium |
| US12301419B2 (en) | 2020-10-08 | 2025-05-13 | Arris Enterprises Llc | Method and apparatus for management of a network configuration session |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104093102A (en) * | 2014-07-30 | 2014-10-08 | 深圳市华美兴泰科技有限公司 | Wireless sound system for transmitting audio based on WIFI and application method of wireless sound system |
| CN104468852A (en) * | 2013-09-18 | 2015-03-25 | 腾讯科技(北京)有限公司 | Method, device and system for client to select IP link address |
| CN104980514A (en) * | 2015-06-19 | 2015-10-14 | 广东欧珀移动通信有限公司 | Remote play control method and apparatus of wireless sound box |
| CN105681444A (en) * | 2016-02-02 | 2016-06-15 | 优听无限传媒科技(北京)有限责任公司 | Method for remotely controlling target wifi loudspeaker box by intelligent terminal |
-
2016
- 2016-07-26 CN CN201610599306.2A patent/CN106028469B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104468852A (en) * | 2013-09-18 | 2015-03-25 | 腾讯科技(北京)有限公司 | Method, device and system for client to select IP link address |
| CN104093102A (en) * | 2014-07-30 | 2014-10-08 | 深圳市华美兴泰科技有限公司 | Wireless sound system for transmitting audio based on WIFI and application method of wireless sound system |
| CN104980514A (en) * | 2015-06-19 | 2015-10-14 | 广东欧珀移动通信有限公司 | Remote play control method and apparatus of wireless sound box |
| CN105681444A (en) * | 2016-02-02 | 2016-06-15 | 优听无限传媒科技(北京)有限责任公司 | Method for remotely controlling target wifi loudspeaker box by intelligent terminal |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106028469A (en) | 2016-10-12 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111405042B (en) | Electronic device discovery method and device, storage medium and electronic device | |
| CN102523314B (en) | Identify the method and apparatus of efficient destination server | |
| CN112152940B (en) | Message processing method, device and system | |
| CN103518342B (en) | A heartbeat signal transmission control method and device | |
| US20170171496A1 (en) | Method and Electronic Device for Screen Projection | |
| KR20150013860A (en) | Clientless cloud computing | |
| EP2803244A2 (en) | Methods and apparatus for establishing a tunneled direct link setup (tdls) session between devices in a wireless network | |
| CN113366815B (en) | Network resource request method, apparatus, electronic device, and storage medium | |
| US20170289243A1 (en) | Domain name resolution method and electronic device | |
| US11706301B2 (en) | Server node selection method and terminal device | |
| CN106713522B (en) | Wireless fidelity Wi-Fi connection method and mobile terminal | |
| CN110545230B (en) | Method and device for forwarding VXLAN message | |
| CN102724334A (en) | Notification and acquisition method, device and system for address information change in digital living network alliance (DLNA) | |
| CN107968848B (en) | A method, terminal device and storage medium for obtaining IP address | |
| US20170034006A1 (en) | Dynamic reconfiguration of network topology for low-latency media transmissions | |
| CN106302230B (en) | A kind of data transmission method and device | |
| CN109787900B (en) | Transmission method, device, equipment and machine readable medium | |
| WO2022100198A1 (en) | Data transmission method and apparatus, storage medium, terminal, and network access point device | |
| CN114745324A (en) | Device identification method, device, storage medium and routing device | |
| CN106028469B (en) | Communication connection establishment method and device and mobile terminal | |
| CN112134826B (en) | Communication method, computer device, and computer-readable storage medium | |
| CN104426816B (en) | A kind of virtual machine communication method and device | |
| CN111262779A (en) | Data acquisition method, device, server and system in instant messaging | |
| CN106470252B (en) | Method for querying IP address by application program and communication terminal | |
| CN104869133A (en) | Data recording method, system and access server |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information | ||
| CB02 | Change of applicant information |
Address after: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong Applicant after: OPPO Guangdong Mobile Communications Co., Ltd. Address before: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong Applicant before: Guangdong OPPO Mobile Communications Co., Ltd. |
|
| GR01 | Patent grant | ||
| GR01 | Patent grant |