CN110784939B - Data communication method, device and system - Google Patents

Data communication method, device and system Download PDF

Info

Publication number
CN110784939B
CN110784939B CN201911067422.XA CN201911067422A CN110784939B CN 110784939 B CN110784939 B CN 110784939B CN 201911067422 A CN201911067422 A CN 201911067422A CN 110784939 B CN110784939 B CN 110784939B
Authority
CN
China
Prior art keywords
mobile terminal
intelligent device
request message
intelligent
hotspot
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
CN201911067422.XA
Other languages
Chinese (zh)
Other versions
CN110784939A (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.)
Shanghai Mxchip Information Technology Co Ltd
Original Assignee
Shanghai Mxchip Information Technology 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 Shanghai Mxchip Information Technology Co Ltd filed Critical Shanghai Mxchip Information Technology Co Ltd
Priority to CN201911067422.XA priority Critical patent/CN110784939B/en
Publication of CN110784939A publication Critical patent/CN110784939A/en
Application granted granted Critical
Publication of CN110784939B publication Critical patent/CN110784939B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/02Arrangements for optimising operational condition
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W80/00Wireless network protocols or protocol adaptations to wireless operation
    • H04W80/06Transport layer protocols, e.g. TCP [Transport Control Protocol] over wireless
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/02Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
    • H04W84/10Small scale networks; Flat hierarchical networks
    • H04W84/12WLAN [Wireless Local Area Networks]

Landscapes

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

Abstract

The invention discloses a data communication method, a device and a system. The method comprises the following steps: the method comprises the steps of obtaining address information and port information, wherein the address information is a communication address allocated to a mobile terminal by the intelligent device in the Wi-Fi hotspot process of the mobile terminal connected with the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance; and carrying out data communication with the mobile terminal by adopting the address information and the port information. The invention solves the technical problems that in the related technology, the connection failure of a local area network and the poor network communication safety are easily caused by taking the APP of the smart phone as a client side of the TCP connection and taking the Wi-Fi assembly of the smart device as a server side of the TCP connection.

Description

Data communication method, device and system
Technical Field
The present invention relates to the field of communications, and in particular, to a data communication method, apparatus, and system.
Background
Currently, a client (e.g., a smart phone Application (APP)) in the related art needs to establish communication with an embedded wireless communication component (e.g., a wireless fidelity (Wi-Fi) component) in a server to meet a specific requirement or achieve a specific purpose. Fig. 1 is a flowchart of a process of establishing communication between a Client and an embedded wireless communication component in a Server according to the related art, where as shown in fig. 1, a smart phone APP serves as a Client (Client) of a Transmission Control Protocol (TCP) connection, and a Wi-Fi component of a smart device serves as a Server (Server) of the TCP connection, the process may include the following steps:
step S102, the intelligent device Wi-Fi assembly starts a local area network Access Point (AP) and starts a Server program to wait for a Client to connect;
step S104, the smart phone APP accesses the AP successfully;
step S106, the smart phone APP serves as a Client and initiates a connection request to a Server through Server address information (ServerIP) and Server port information (ServerPort) agreed by a pre-protocol;
and step S108, the connection between the Client terminal and the Server terminal is successfully established, and communication is started.
However, the above communication interaction flow has the following technical drawbacks:
(1) after the 4G network is opened to the smart phone of some models, the connection request that smart phone APP sent can't reach smart machine Wi-Fi subassembly to lead to the LAN connection failure between smart phone APP and the smart machine Wi-Fi subassembly, its leading cause lies in: after the 4G network is started, if the local area network AP started by the Wi-Fi component of the intelligent device is connected again, the 4G network channel is used by default for network communication.
(2) The smart phone produced by a particular manufacturer may default to closing or prohibiting the network port of the smart phone, thereby causing a failure in the local area network connection between the smart phone APP and the smart device Wi-Fi component.
(3) The Internet Protocol (IP) address of the Wi-Fi component of the intelligent device is relatively fixed, and the safety of the Wi-Fi component is poor.
(4) Under a mixed channel (2.4G/5G) Wi-Fi router, a smart device Wi-Fi component adopting a 2.4G channel cannot establish TCP connection with a smart phone APP and complete service communication.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
At least some embodiments of the present invention provide a data communication method, apparatus, and system, so as to solve at least the technical problems in the related art that a connection failure of a local area network and a poor network communication security are easily caused when an APP of a smart phone is used as a client of a TCP connection and a Wi-Fi component of a smart device is used as a server of the TCP connection.
According to an embodiment of the present invention, there is provided a data communication method including:
the method comprises the steps of obtaining address information and port information, wherein the address information is a communication address allocated to a mobile terminal by the intelligent device in the Wi-Fi hotspot process of the mobile terminal connected with the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance; and carrying out data communication with the mobile terminal by adopting the address information and the port information.
Optionally, before acquiring the address information, the method further includes: receiving an access request message from a mobile terminal, wherein the access request message is used for requesting access to a Wi-Fi hotspot of intelligent equipment; responding to the access request message, and under the condition that the mobile terminal is successfully accessed to the Wi-Fi hotspot of the intelligent device, allocating address information to the mobile terminal by using the Wi-Fi bottom layer assembly of the intelligent device.
Optionally, the obtaining the address information includes: and calling back the address information to a Wi-Fi application layer component of the intelligent device by using the Wi-Fi bottom component of the intelligent device so that the Wi-Fi application layer component performs data communication with the mobile terminal by adopting the address information and the port information.
Optionally, the performing data communication with the mobile terminal by using the address information and the port information includes: sending a connection request message to the mobile terminal, wherein the information carried in the connection request message comprises: the connection request message is used for requesting to establish TCP connection with the mobile terminal; receiving a response message corresponding to the connection request message returned by the mobile terminal, wherein the response message is used for notifying that the TCP connection is established successfully; and performing data communication with the mobile terminal by adopting TCP connection.
Optionally, after receiving the response message returned by the mobile terminal, the method further includes: the remaining threads that are attempting to establish a TCP connection are destroyed immediately.
Optionally, after performing data communication with the mobile terminal by using the address information and the port information, the method further includes: and informing the Wi-Fi bottom layer component of the intelligent device to close the Wi-Fi hotspot of the intelligent device by utilizing the Wi-Fi application layer component of the intelligent device.
According to an embodiment of the present invention, there is provided another data communication method, including:
receiving a connection request message from the intelligent device, wherein the information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal, the address information is a communication address distributed to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the intelligent device connected with the mobile terminal, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance; and responding to the connection request message, and returning a response message to the intelligent device so as to enable the intelligent device to carry out data communication with the mobile terminal, wherein the response message is used for informing that the TCP connection is successfully established.
Optionally, before receiving the connection request message from the smart device, the method further includes: sending an access request message to the intelligent equipment, wherein the access request message is used for requesting access to a Wi-Fi hotspot of the intelligent equipment; and receiving address information distributed by the Wi-Fi bottom layer component of the intelligent device in response to the access request message.
Optionally, before sending the access request message to the smart device, the method further includes: scanning a Wi-Fi hotspot of the intelligent device, and recording identification information of the Wi-Fi hotspot of the intelligent device into a local cache; and if the Wi-Fi hotspot of the intelligent equipment to be accessed currently is determined to be the hotspot connected for the first time, configuring the mobile terminal as a service end connected with the TCP.
Optionally, after returning the response message to the smart device, the method further includes: if the mobile terminal is abnormally accessed to the Wi-Fi hotspot of the router under the condition that the data communication between the intelligent device and the mobile terminal is not started or the data transmission is not finished, the Wi-Fi hotspot of the router is disconnected and accessed to the Wi-Fi hotspot of the intelligent device again, so that the intelligent device and the mobile terminal can perform data communication again.
According to an embodiment of the present invention, there is provided a data communication apparatus including:
the acquisition module is used for acquiring address information and port information, wherein the address information is a communication address allocated to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the mobile terminal connected with the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance; and the processing module is used for carrying out data communication with the mobile terminal by adopting the address information and the port information.
Optionally, the apparatus further comprises: the mobile terminal comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving an access request message from the mobile terminal, and the access request message is used for requesting to access a Wi-Fi hotspot of the intelligent device; and the allocation module is used for responding to the access request message and allocating the address information to the mobile terminal by using the Wi-Fi bottom layer assembly of the intelligent equipment under the condition that the mobile terminal is successfully accessed to the Wi-Fi hotspot of the intelligent equipment.
Optionally, the obtaining module is configured to call back the address information to a Wi-Fi application layer component of the smart device by using a Wi-Fi underlying component of the smart device, so that the Wi-Fi application layer component performs data communication with the mobile terminal by using the address information and the port information.
Optionally, the processing module comprises: a sending unit, configured to send a connection request message to a mobile terminal, where information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal; the receiving unit is used for receiving a response message which is returned by the mobile terminal and corresponds to the connection request message, wherein the response message is used for notifying that the TCP connection is successfully established; and the processing unit is used for carrying out data communication with the mobile terminal by adopting TCP connection.
Optionally, the apparatus further comprises: and the destroying module is used for immediately destroying the rest threads which are trying to establish the TCP connection.
Optionally, the apparatus further comprises: and the notification module is used for notifying the Wi-Fi bottom layer component of the intelligent device to close the Wi-Fi hotspot of the intelligent device by utilizing the Wi-Fi application layer component of the intelligent device.
According to an embodiment of the present invention, there is provided another data communication apparatus including:
a first receiving module, configured to receive a connection request message from an intelligent device, where information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal, the address information is a communication address distributed to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the intelligent device connected with the mobile terminal, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance; and the response module is used for responding to the connection request message and returning a response message to the intelligent equipment so as to enable the intelligent equipment to carry out data communication with the mobile terminal, wherein the response message is used for informing that the TCP connection is successfully established.
Optionally, the apparatus further comprises: the device comprises a sending module, a receiving module and a sending module, wherein the sending module is used for sending an access request message to the intelligent equipment, and the access request message is used for requesting to access a Wi-Fi hotspot of the intelligent equipment; and the second receiving module is used for receiving the address information distributed by the Wi-Fi bottom layer assembly of the intelligent equipment in response to the access request message.
Optionally, the apparatus further comprises: the scanning module is used for scanning the Wi-Fi hotspots of the intelligent equipment and recording the identification information of the Wi-Fi hotspots of the intelligent equipment into a local cache; and the configuration module is used for configuring the mobile terminal as a service end of the TCP connection if the Wi-Fi hotspot of the intelligent equipment to be accessed currently is determined to be the hotspot connected for the first time.
Optionally, the apparatus further comprises: and the processing module is used for disconnecting the Wi-Fi hotspot of the router and re-accessing the Wi-Fi hotspot of the intelligent device if the mobile terminal is determined to abnormally access the Wi-Fi hotspot of the router under the condition that the data communication between the intelligent device and the mobile terminal is not started or the data transmission is not finished, so that the intelligent device and the mobile terminal can perform data communication again.
There is also provided, according to an embodiment of the present invention, a data communication system including: intelligent equipment and a mobile terminal; the intelligent device is configured as a client of a TCP connection, comprising: the data communication device of any of the above; the mobile terminal is configured as a server of TCP connection, comprising: another data communications apparatus as in any above.
In at least part of embodiments of the invention, a mobile terminal is adopted to obtain address information and port information, the address information is a communication address distributed to the mobile terminal by the intelligent device in the process that the mobile terminal is connected with a Wi-Fi hotspot of the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance, the mobile terminal adopts the address information and the port information to carry out data communication with the mobile terminal, so that the purposes of configuring the intelligent device as a client side of TCP connection and configuring the mobile terminal as a server side of TCP connection, establishing TCP connection between the intelligent device and the mobile terminal to enable the intelligent device and the mobile terminal to carry out data communication are achieved, the technical effects of effectively improving the success rate of establishing TCP connection and strengthening network communication safety are achieved, and the technical effects of taking the intelligent mobile phone as the client side of TCP connection and using the intelligent device APP as a Wi-Fi group of the intelligent device in related technologies are further solved The element is used as a service end of TCP connection, which easily causes the technical problems of connection failure of a local area network and poor network communication safety.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a flowchart illustrating a process of establishing communication between a client and an embedded wireless communication component in a server according to the related art;
FIG. 2 is a flow chart of a method of data communication according to one embodiment of the present invention;
FIG. 3 is a flow diagram of a process for establishing TCP communication between a smartphone APP and a smart device Wi-Fi component according to an alternative embodiment of the present invention;
FIG. 4 is a flow diagram of a process for establishing TCP communication between a smartphone APP and a Wi-Fi application layer component of a smart device in accordance with an alternative embodiment of the present invention;
FIG. 5 is a flow chart of another method of data communication according to one embodiment of the present invention;
fig. 6 is a block diagram of a data communication apparatus according to an embodiment of the present invention;
FIG. 7 is a block diagram of a data communication device according to an alternative embodiment of the present invention;
FIG. 8 is a block diagram of another data communication device according to one embodiment of the present invention;
fig. 9 is a block diagram of another data communication device in accordance with an alternate embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with one embodiment of the present invention, there is provided an embodiment of a data communication method, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than that herein.
The method embodiment can be executed in intelligent equipment (such as intelligent home equipment such as an intelligent dehumidifier, an intelligent air purifier, an intelligent air conditioner, an intelligent refrigerator, an intelligent microwave oven, an intelligent washing machine, an intelligent desk lamp and the like) or similar operation devices. For example, operating on a smart device, the smart device may include one or more processors (which may include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Digital Signal Processing (DSP) chip, a Microprocessor (MCU), or a programmable logic device (FPGA)), etc., and memory for storing data. Optionally, the smart device may further include a transmission device for a communication function and an input/output device. It will be understood by those skilled in the art that the foregoing structural description is illustrative only and is not intended to limit the structure of the smart device. For example, a smart device may also include more or fewer components than described above, or have a different configuration than described above.
The memory may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the data communication method in the embodiments of the present invention, and the processor executes various functional applications and data processing by running the computer programs stored in the memory, that is, implementing the data communication method described above. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory remotely located from the processor, and these remote memories may be connected to the smart device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the smart device. In one example, the transmitting device includes a Wi-Fi component.
In this embodiment, a data communication method operating in the above intelligent device is provided, and fig. 2 is a flowchart of the data communication method according to an embodiment of the present invention, as shown in fig. 2, the method includes the following steps:
step S22, address information and port information are obtained, wherein the address information is a communication address allocated to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the mobile terminal connected with the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
and step S24, performing data communication with the mobile terminal by adopting the address information and the port information.
Through the steps, the intelligent equipment can be adopted to obtain address information and port information, the address information is a communication address distributed to the mobile terminal by the intelligent equipment in the Wi-Fi hotspot process of the intelligent equipment connected with the mobile terminal, and the port information is a communication port agreed by the intelligent equipment and the mobile terminal in advance, data communication is carried out between the intelligent equipment and the mobile terminal by adopting the address information and the port information through the intelligent equipment, so that the purposes of configuring the intelligent equipment into a client side of TCP connection and configuring the mobile terminal into a server side of TCP connection, establishing TCP connection between the intelligent equipment and the mobile terminal to enable the intelligent equipment and the mobile terminal to carry out data communication are achieved, the success rate of establishing TCP connection is effectively improved, the technical effect of strengthening network communication safety is achieved, and the technical effects that the intelligent mobile phone is used as the client side of TCP connection and the intelligent equipment Wi-Fi assembly is used as a TCP APP in the related technology are further solved The connected server easily causes the technical problems of connection failure of the local area network and poor network communication safety.
Optionally, before the step S22, the method may further include the following steps:
step S20, receiving an access request message from the mobile terminal, wherein the access request message is used for requesting access to a Wi-Fi hotspot of the intelligent device;
and step S21, responding to the access request message, and under the condition that the mobile terminal is successfully accessed to the Wi-Fi hotspot of the intelligent device, allocating address information to the mobile terminal by using the Wi-Fi bottom layer assembly of the intelligent device.
In the optional embodiment provided by the invention, the smart phone APP is used as a Server end of the TCP connection, and the smart device Wi-Fi assembly is used as a Client end of the TCP connection.
Fig. 3 is a flowchart of a process of establishing TCP communication between a smart phone APP and a smart device Wi-Fi component according to an alternative embodiment of the present invention, where as shown in fig. 3, the smart phone APP serves as a Server end of a TCP connection, and the smart device Wi-Fi component serves as a Client end of the TCP connection, and the process may include the following steps:
step S302, the Wi-Fi component of the intelligent device starts an AP (access point) of a local area network and monitors the condition that the intelligent mobile phone is connected with the AP;
step S304, the smart phone APP actively connects the AP started by the smart device Wi-Fi assembly, starts a Server program, binds a Port agreed by a pre-agreement, and waits for a connection request of the smart device Wi-Fi assembly;
step S306, the intelligent device Wi-Fi component monitors that the intelligent mobile phone APP is connected with the started AP, and initiates a connection request to the intelligent mobile phone APP through a pre-allocated IP address and a pre-agreed Port;
and step S308, the connection between the Client terminal and the Server terminal is successfully established, and communication is started.
In the process that the intelligent device Wi-Fi component monitors the connection of the intelligent mobile phone to the AP, the intelligent device Wi-Fi component receives an access request message from the mobile terminal, wherein the access request message is used for requesting access to a Wi-Fi hotspot of the intelligent device. And if the mobile terminal is successfully accessed to the Wi-Fi hotspot of the intelligent device, responding to the access request message by the Wi-Fi assembly of the intelligent device, and allocating address information to the mobile terminal by using the Wi-Fi bottom assembly of the intelligent device.
Alternatively, in step S22, acquiring the address information may include performing the steps of:
and S221, calling back the address information to a Wi-Fi application layer component of the intelligent device by using the Wi-Fi bottom component of the intelligent device, so that the Wi-Fi application layer component performs data communication with the mobile terminal by adopting the address information and the port information.
Under the condition that the Wi-Fi component of the intelligent device serves as a Client of the TCP, in order to monitor the intelligent mobile phone connected to the AP opened by the Wi-Fi component of the intelligent device in real time and acquire the IP address allocated to the intelligent mobile phone by the Wi-Fi bottom component of the intelligent device, the Wi-Fi bottom component of the intelligent device is required to call back the IP address allocated to the intelligent mobile phone to the Wi-Fi application layer component of the intelligent device. The Wi-Fi application layer component of the intelligent device can dynamically capture the IP address of the intelligent mobile phone through the call-back process, so that the Wi-Fi application layer component can carry out data communication with the mobile terminal by adopting the address information and the port information.
Alternatively, in step S24, the data communication with the mobile terminal using the address information and the port information may include the following steps:
step S241, sending a connection request message to the mobile terminal, where the information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal;
step S242, receiving a response message corresponding to the connection request message returned by the mobile terminal, where the response message is used to notify that the TCP connection is established successfully;
and step S243, performing data communication with the mobile terminal by using a TCP connection.
After the Wi-Fi application layer component of the intelligent device acquires the IP address which is distributed to the intelligent mobile phone by the Wi-Fi bottom layer component and the Port agreed by the protocol in advance, a connection request message is sent to the mobile terminal to request to establish TCP connection with the mobile terminal. The information carried in the connection request message includes: the Wi-Fi underlying component allocates an IP address for the smart phone and a Port agreed by a pre-agreement. Then, the Wi-Fi application layer component of the intelligent device receives a response message corresponding to the connection request message returned by the mobile terminal, and determines that the TCP connection is established successfully through the response message. Finally, the Wi-Fi application layer component of the smart device may communicate data with the mobile terminal using a TCP connection.
Fig. 4 is a flowchart of a process of establishing TCP communication between a smartphone APP and a Wi-Fi application layer component of a smart device according to an alternative embodiment of the present invention, where as shown in fig. 4, the process may include the following steps:
s402, a Wi-Fi application layer component of the intelligent device informs a Wi-Fi bottom layer component of the intelligent device to start an AP (access point) of a local area network, and monitors the condition that the intelligent mobile phone is connected with the AP;
s404, successfully starting the local area network AP by the Wi-Fi bottom layer component of the intelligent equipment;
step S406, a Wi-Fi bottom layer component of the intelligent equipment receives an access request message from the intelligent mobile phone, wherein the access request message is used for requesting to access a local area network AP started by the intelligent equipment;
step S408, if the smart phone is successfully accessed to the Wi-Fi hotspot of the smart device, the Wi-Fi bottom component of the smart device responds to the access request message and allocates an IP address to the smart phone;
s410, the Wi-Fi bottom layer component of the intelligent equipment calls back an IP address distributed for the intelligent mobile phone to a Wi-Fi application layer component of the intelligent equipment;
step S412, the Wi-Fi application layer component of the intelligent device sends a connection request message to the intelligent mobile phone to request to establish a TCP connection with the intelligent mobile phone. The information carried in the connection request message includes: the Wi-Fi bottom layer component allocates an IP address for the smart phone and a Port agreed by a protocol in advance;
step S414, the Wi-Fi application layer component of the intelligent equipment receives a response message corresponding to the connection request message returned by the intelligent mobile phone, and determines that the TCP connection is successfully established through the response message;
and S416, the Wi-Fi application layer component of the intelligent device performs data communication with the mobile terminal by adopting TCP connection.
Optionally, in step S242, after receiving the response message returned by the mobile terminal, the following steps may be further included:
in step S244, the remaining threads that are attempting to establish TCP connections are destroyed immediately.
Under the condition that the Wi-Fi component of the intelligent device serves as a Client end of the TCP, accurate and quick TCP connection with the smart phone APP is carried out for achieving the Wi-Fi application layer component of the intelligent device on the premise that the Wi-Fi component of the intelligent device does not affect stable operation of the Wi-Fi component, connection and communication are established between the Wi-Fi application layer component of the intelligent device and the smart phone APPs for avoiding the Wi-Fi application layer from being connected with and communicating with the smart phone APP at the same time, data interference is caused, real-time processing is needed to be carried out when the Wi-Fi application layer component of the intelligent device receives IP addresses of a plurality of Wi-Fi bottom layer components from the intelligent device and TCP connection with the IP addresses is tried to be established respectively. As soon as one of the IP addresses is found to be able to establish a TCP connection successfully, the remaining threads that are trying to establish a TCP connection are destroyed immediately. Namely, the Wi-Fi application layer component of the intelligent device and the intelligent mobile phone are kept in one-to-one communication relation in the same time period.
Optionally, after the step S24, the method may further include the following steps after performing data communication with the mobile terminal using the address information and the port information:
and step S25, notifying a Wi-Fi bottom layer component of the intelligent device to close the Wi-Fi hotspot of the intelligent device by using the Wi-Fi application layer component of the intelligent device.
Under the condition that the Wi-Fi assembly of the intelligent device serves as the Client end of the TCP, in order to ensure that the Wi-Fi assembly of the intelligent device and the intelligent mobile phone can normally communicate, if the Wi-Fi application layer assembly of the intelligent device finds that the intelligent mobile phone APP does not need to continue to use a local area network AP successfully opened by the Wi-Fi bottom assembly of the intelligent device, the Wi-Fi bottom assembly of the intelligent device should be timely notified to close the local area network AP so as to prevent the intelligent mobile phone APP from being always connected to the local area network AP successfully opened by the Wi-Fi bottom assembly and failing to be timely switched to the AP opened by the router, and therefore connection failure between the Wi-Fi application layer assembly of the intelligent device and the intelligent mobile phone caused by the fact that normal internet access cannot be conducted is caused.
In accordance with one embodiment of the present invention, another embodiment of a data communication method is provided, it should be noted that the steps illustrated in the flowchart of the figure can be performed in a computer system such as a set of computer-executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described can be performed in an order different than here.
The method embodiments may be performed in a mobile terminal or similar computing device. For example, operating on a mobile terminal, the mobile terminal may include one or more processors (which may include, but are not limited to, a processing device such as a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Digital Signal Processing (DSP) chip, a Microprocessor (MCU), or a programmable logic device (FPGA)), and memory for storing data. Optionally, the mobile terminal may further include a transmission device, an input/output device, and a display device for a communication function. It will be understood by those skilled in the art that the foregoing structural description is only illustrative and not restrictive of the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than described above, or have a different configuration than described above.
The memory may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the data communication method in the embodiments of the present invention, and the processor executes various functional applications and data processing by running the computer programs stored in the memory, that is, implementing the data communication method described above. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory located remotely from the processor, and these remote memories may be connected to the mobile terminal through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The display device may be, for example, a touch screen type Liquid Crystal Display (LCD) and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a Graphical User Interface (GUI) with which a user can interact by touching finger contacts and/or gestures on a touch-sensitive surface, where the human-machine interaction function optionally includes the following interactions: executable instructions for creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, emailing, call interfacing, playing digital video, playing digital music, and/or web browsing, etc., for performing the above-described human-computer interaction functions, are configured/stored in one or more processor-executable computer program products or readable storage media.
In this embodiment, a data communication method operating in the mobile terminal is provided, and fig. 5 is a flowchart of another data communication method according to an embodiment of the present invention, as shown in fig. 5, the method includes the following steps:
step S54, receiving a connection request message from the smart device, where the information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal, the address information is a communication address distributed to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the intelligent device connected with the mobile terminal, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
and step S56, responding to the connection request message, and returning a response message to the intelligent device to enable the intelligent device to perform data communication with the mobile terminal, wherein the response message is used for notifying that the TCP connection is successfully established.
Through the steps, the mobile terminal can be adopted to receive a connection request message from the intelligent device, the information carried in the connection request message comprises address information and port information, the connection request message is used for requesting to establish a TCP connection with the mobile terminal, the address information is a communication address allocated to the mobile terminal by the intelligent device in the process that the mobile terminal is connected with a Wi-Fi hotspot of the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance protocol, a response message is returned to the intelligent device through the mobile terminal in response to the connection request message, so that the intelligent device and the mobile terminal carry out data communication, a client side configuring the intelligent device as a TCP connection and a server side configuring the mobile terminal as a TCP connection are achieved, the TCP connection is established between the intelligent device and the mobile terminal, and the intelligent device and the mobile terminal carry out data communication, therefore, the technical effects of effectively improving the success rate of establishing the TCP connection and strengthening the network communication safety are achieved, and the technical problems that in the related technology, the smart phone APP is used as a client side of the TCP connection and the Wi-Fi assembly of the smart device is used as a server side of the TCP connection, the connection failure of a local area network is easily caused, and the network communication safety is poor are solved.
Optionally, before receiving the connection request message from the smart device in step S54, the method may further include the following steps:
step S52, sending an access request message to the intelligent device, wherein the access request message is used for requesting access to a Wi-Fi hotspot of the intelligent device;
and step S53, receiving address information allocated by the Wi-Fi bottom layer component of the intelligent device in response to the access request message.
The Wi-Fi component of the intelligent device can start the AP of the local area network and monitor the condition that the intelligent mobile phone is connected with the AP. The smart phone APP is actively connected with the AP started by the Wi-Fi component of the smart device. In the process that the intelligent device Wi-Fi component monitors the connection of the intelligent mobile phone to the AP, the intelligent device Wi-Fi component receives an access request message from the mobile terminal, wherein the access request message is used for requesting access to a Wi-Fi hotspot of the intelligent device. And if the mobile terminal is successfully accessed to the Wi-Fi hotspot of the intelligent device, responding to the access request message by the Wi-Fi assembly of the intelligent device, and allocating address information to the mobile terminal by using the Wi-Fi bottom assembly of the intelligent device.
Optionally, before sending the access request message to the smart device in step S52, the method may further include the following steps:
step S50, scanning a Wi-Fi hotspot of the intelligent device, and recording identification information of the Wi-Fi hotspot of the intelligent device into a local cache;
step S51, if the Wi-Fi hotspot of the current intelligent device to be accessed is determined to be the hotspot connected for the first time, the mobile terminal is configured to be a TCP connection server.
In the optional embodiment provided by the invention, the smart phone APP is used as a Server end of the TCP connection, and the smart device Wi-Fi assembly is used as a Client end of the TCP connection.
Under the condition that the smart phone APP serves as a Server end of the TCP, the smart phone APP scans whether a Wi-Fi name currently connected with the mobile phone system is an AP started by a Wi-Fi bottom layer component of the smart device in real time, and if so, the Wi-Fi name is recorded into a local cache of the mobile phone system; meanwhile, if the smart phone APP determines that the Wi-Fi hotspot of the smart device to be accessed currently is the hotspot connected for the first time, the Server end is set up, so that the smart phone is configured as a Server end connected with the TCP.
Optionally, in step S56, after the response message is returned to the smart device, the method may further include the following steps:
step S57, if it is determined that the mobile terminal abnormally accesses the Wi-Fi hotspot of the router under the condition that the data communication between the intelligent device and the mobile terminal is not started or the data transmission is not finished, the Wi-Fi hotspot of the router is disconnected and the Wi-Fi hotspot of the intelligent device is accessed again, so that the intelligent device and the mobile terminal can perform data communication again.
If the smart phone APP has successfully established the TCP connection with the smart device Wi-Fi assembly, but data communication is not started yet or data transmission is not finished yet, at the moment, if the smart phone has a jump abnormity to access to a Wi-Fi hotspot of the router, the smart phone APP originally has successfully established the TCP connection with the smart device Wi-Fi assembly and is interrupted, at the moment, the smart phone APP is required to disconnect the Wi-Fi hotspot of the router and re-access the Wi-Fi hotspot of the smart device, so that the TCP connection is re-established between the smart phone APP and the smart device Wi-Fi assembly, and the smart device and the smart phone APP can re-perform data communication.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a data communication device is further provided, and the data communication device is used to implement the foregoing embodiments and preferred embodiments, which have already been described and are not described again. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 6 is a block diagram of a data communication apparatus according to an embodiment of the present invention, as shown in fig. 6, the apparatus including: the acquisition module 11 is configured to acquire address information and port information, where the address information is a communication address allocated to the mobile terminal by the intelligent device in a Wi-Fi hotspot process where the mobile terminal is connected to the intelligent device, and the port information is a communication port agreed by a protocol in advance between the intelligent device and the mobile terminal; and the processing module 12 is used for performing data communication with the mobile terminal by adopting the address information and the port information.
Optionally, fig. 7 is a block diagram of a data communication device according to an alternative embodiment of the present invention, and as shown in fig. 7, the data communication device includes, in addition to all the modules shown in fig. 6: the receiving module 13 is configured to receive an access request message from the mobile terminal, where the access request message is used to request access to a Wi-Fi hotspot of the smart device; the allocating module 14 is configured to, in response to the access request message, allocate address information to the mobile terminal by using a Wi-Fi underlying component of the smart device when the mobile terminal successfully accesses the Wi-Fi hotspot of the smart device.
Optionally, the obtaining module 11 is configured to call back the address information to a Wi-Fi application layer component of the smart device by using a Wi-Fi underlying component of the smart device, so that the Wi-Fi application layer component performs data communication with the mobile terminal by using the address information and the port information.
Optionally, the processing module 12 comprises: a sending unit (not shown in the figure), configured to send a connection request message to the mobile terminal, where the information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal; a receiving unit (not shown in the figure) for receiving a response message corresponding to the connection request message returned by the mobile terminal, wherein the response message is used for notifying that the TCP connection is established successfully; a processing unit (not shown in the figure) for data communication with the mobile terminal using a TCP connection.
Optionally, as shown in fig. 7, the apparatus includes, in addition to all the modules shown in fig. 6: and the destroying module 15 is used for immediately destroying the rest threads which are trying to establish the TCP connection.
Optionally, as shown in fig. 7, the apparatus includes, in addition to all the modules shown in fig. 6: and the notification module 16 is configured to notify a Wi-Fi underlying component of the smart device to close a Wi-Fi hotspot of the smart device by using the Wi-Fi application layer component of the smart device.
In this embodiment, another data communication device is provided, which is used to implement the above embodiments and preferred embodiments, and the description of the device is omitted for brevity. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 8 is a block diagram of another data communication apparatus according to an embodiment of the present invention, as shown in fig. 8, the apparatus including: a first receiving module 21, configured to receive a connection request message from an intelligent device, where information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal, the address information is a communication address distributed to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the intelligent device connected with the mobile terminal, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance; and a response module 22, configured to return a response message to the smart device in response to the connection request message, so that the smart device performs data communication with the mobile terminal, where the response message is used to notify that the TCP connection is successfully established.
Optionally, fig. 9 is a block diagram of another data communication apparatus according to an alternative embodiment of the present invention, and as shown in fig. 9, the apparatus includes, in addition to all modules shown in fig. 8: the sending module 23 is configured to send an access request message to the intelligent device, where the access request message is used to request access to a Wi-Fi hotspot of the intelligent device; and a second receiving module 24, configured to receive address information allocated by the Wi-Fi infrastructure component of the smart device in response to the access request message.
Optionally, as shown in fig. 9, the apparatus includes, in addition to all the modules shown in fig. 8: the scanning module 25 is configured to scan a Wi-Fi hotspot of the smart device, and record identification information of the Wi-Fi hotspot of the smart device in a local cache; the configuration module 26 is configured to configure the mobile terminal as a server of TCP connection if it is determined that the Wi-Fi hotspot of the current smart device to be accessed is a hotspot of first connection.
Optionally, as shown in fig. 9, the apparatus includes, in addition to all the modules shown in fig. 8: and the processing module 27 is configured to disconnect the Wi-Fi hotspot of the router and reconnect the Wi-Fi hotspot of the smart device if it is determined that the mobile terminal abnormally accesses the Wi-Fi hotspot of the router under the condition that data communication between the smart device and the mobile terminal has not started or data transmission has not ended, so that the smart device and the mobile terminal resume data communication.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, address information and port information are obtained, wherein the address information is a communication address allocated to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the mobile terminal connected with the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
and S2, performing data communication with the mobile terminal by adopting the address information and the port information.
Optionally, in this embodiment, the storage medium may be further configured to store a computer program for executing the following steps:
s1, receiving a connection request message from the smart device, where the information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal, the address information is a communication address distributed to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the intelligent device connected with the mobile terminal, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
and S2, responding to the connection request message, and returning a response message to the intelligent device so as to enable the intelligent device to perform data communication with the mobile terminal, wherein the response message is used for notifying that the TCP connection is successfully established.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, address information and port information are obtained, wherein the address information is a communication address allocated to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the mobile terminal connected with the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
and S2, performing data communication with the mobile terminal by adopting the address information and the port information.
Optionally, in this embodiment, the processor may be further configured to execute, by the computer program, the following steps:
s1, receiving a connection request message from the smart device, where the information carried in the connection request message includes: the connection request message is used for requesting to establish TCP connection with the mobile terminal, the address information is a communication address distributed to the mobile terminal by the intelligent device in the Wi-Fi hotspot process of the intelligent device connected with the mobile terminal, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
and S2, responding to the connection request message, and returning a response message to the intelligent device so as to enable the intelligent device to perform data communication with the mobile terminal, wherein the response message is used for notifying that the TCP connection is successfully established.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (19)

1. A method of data communication, comprising:
the method comprises the steps of obtaining address information and port information, wherein the address information is a communication address distributed to a mobile terminal by the intelligent device in the process that the mobile terminal is connected with a wireless fidelity Wi-Fi hotspot of the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
establishing a Transmission Control Protocol (TCP) connection with the mobile terminal by adopting the address information and the port information, and performing data communication with the mobile terminal by adopting the TCP connection, wherein the intelligent equipment is configured as a client of the TCP connection, and the mobile terminal is configured as a server of the TCP connection;
after performing data communication with the mobile terminal by using the address information and the port information, the method further includes: and notifying a Wi-Fi bottom layer component of the intelligent device to close the Wi-Fi hotspot of the intelligent device by utilizing the Wi-Fi application layer component of the intelligent device.
2. The method of claim 1, further comprising, prior to obtaining the address information:
receiving an access request message from the mobile terminal, wherein the access request message is used for requesting access to a Wi-Fi hotspot of the intelligent device;
responding to the access request message, and distributing the address information to the mobile terminal by using a Wi-Fi bottom component of the intelligent equipment under the condition that the mobile terminal successfully accesses the Wi-Fi hotspot of the intelligent equipment.
3. The method of claim 1, wherein obtaining the address information comprises:
and calling back the address information to a Wi-Fi application layer component of the intelligent equipment by using the Wi-Fi bottom layer component of the intelligent equipment so that the Wi-Fi application layer component performs data communication with the mobile terminal by adopting the address information and the port information.
4. The method of claim 1, wherein using the address information and the port information for data communication with the mobile terminal comprises:
sending a connection request message to the mobile terminal, wherein the information carried in the connection request message includes: the address information and the port information, the connection request message is used for requesting to establish a Transmission Control Protocol (TCP) connection with the mobile terminal;
receiving a response message corresponding to the connection request message returned by the mobile terminal, wherein the response message is used for notifying that the TCP connection is established successfully;
and performing data communication with the mobile terminal by adopting the TCP connection.
5. The method according to claim 4, further comprising, after receiving the response message returned by the mobile terminal:
the remaining threads that are attempting to establish a TCP connection are destroyed immediately.
6. A method of data communication, comprising:
receiving a connection request message from an intelligent device, wherein information carried in the connection request message includes: the connection request message is used for requesting to establish a Transmission Control Protocol (TCP) connection with the mobile terminal, the address information is a communication address allocated to the mobile terminal by the intelligent device in the process that the mobile terminal is connected with a wireless fidelity (Wi-Fi) hotspot of the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
responding to the connection request message, and returning a response message to the intelligent device so as to enable the intelligent device to perform data communication with the mobile terminal, wherein the response message is used for notifying that the TCP connection is established successfully, the intelligent device is configured as a client of the TCP connection, and the mobile terminal is configured as a server of the TCP connection;
wherein the method further comprises: and notifying a Wi-Fi bottom layer component of the intelligent device to close the Wi-Fi hotspot of the intelligent device by utilizing the Wi-Fi application layer component of the intelligent device.
7. The method of claim 6, further comprising, prior to receiving the connection request message from the smart device:
sending an access request message to the intelligent device, wherein the access request message is used for requesting access to a Wi-Fi hotspot of the intelligent device;
and receiving the address information allocated by the Wi-Fi bottom layer component of the intelligent device in response to the access request message.
8. The method of claim 7, further comprising, prior to sending an access request message to the smart device:
scanning the Wi-Fi hotspots of the intelligent equipment, and recording the identification information of the Wi-Fi hotspots of the intelligent equipment into a local cache;
and if the Wi-Fi hotspot of the intelligent equipment to be accessed currently is determined to be the hotspot connected for the first time, configuring the mobile terminal as the server side of the TCP connection.
9. The method of claim 6, further comprising, after returning a response message to the smart device:
if the situation that data communication is not started between the intelligent device and the mobile terminal or data transmission is not finished is determined, the mobile terminal is abnormally accessed to the Wi-Fi hotspot of the router, the Wi-Fi hotspot of the router is disconnected, and the Wi-Fi hotspot of the intelligent device is accessed again, so that the intelligent device and the mobile terminal can perform data communication again.
10. A data communication apparatus, comprising:
the mobile terminal comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring address information and port information, the address information is a communication address allocated to the mobile terminal by the intelligent device in the process that the mobile terminal is connected with a wireless fidelity Wi-Fi hotspot of the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
the processing module is used for establishing a Transmission Control Protocol (TCP) connection with the mobile terminal by adopting the address information and the port information and carrying out data communication with the mobile terminal by adopting the TCP connection, wherein the intelligent equipment is configured as a client of the TCP connection, and the mobile terminal is configured as a server of the TCP connection;
wherein the apparatus further comprises: and the notification module is used for notifying the Wi-Fi bottom layer component of the intelligent equipment to close the Wi-Fi hotspot of the intelligent equipment by utilizing the Wi-Fi application layer component of the intelligent equipment.
11. The apparatus of claim 10, further comprising:
the mobile terminal comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving an access request message from the mobile terminal, and the access request message is used for requesting to access a Wi-Fi hotspot of the intelligent device;
and the allocation module is used for responding to the access request message, and allocating the address information to the mobile terminal by using a Wi-Fi bottom layer assembly of the intelligent equipment under the condition that the mobile terminal is successfully accessed to the Wi-Fi hotspot of the intelligent equipment.
12. The apparatus of claim 10, wherein the obtaining module is configured to call back the address information to a Wi-Fi application layer component of the smart device by using a Wi-Fi infrastructure component of the smart device, so that the Wi-Fi application layer component performs data communication with the mobile terminal by using the address information and the port information.
13. The apparatus of claim 10, wherein the processing module comprises:
a sending unit, configured to send a connection request message to the mobile terminal, where information carried in the connection request message includes: the address information and the port information, the connection request message is used for requesting to establish a Transmission Control Protocol (TCP) connection with the mobile terminal;
a receiving unit, configured to receive a response message corresponding to the connection request message, where the response message is used to notify that the TCP connection is established successfully, where the response message is returned by the mobile terminal;
and the processing unit is used for carrying out data communication with the mobile terminal by adopting the TCP connection.
14. The apparatus of claim 13, further comprising:
and the destroying module is used for immediately destroying the rest threads which are trying to establish the TCP connection.
15. A data communication apparatus, comprising:
a first receiving module, configured to receive a connection request message from an intelligent device, where information carried in the connection request message includes: the connection request message is used for requesting to establish a Transmission Control Protocol (TCP) connection with the mobile terminal, the address information is a communication address allocated to the mobile terminal by the intelligent device in the process that the mobile terminal is connected with a wireless fidelity (Wi-Fi) hotspot of the intelligent device, and the port information is a communication port agreed by the intelligent device and the mobile terminal in advance;
a response module, configured to return a response message to the smart device in response to the connection request message, so that the smart device performs data communication with the mobile terminal, where the response message is used to notify that the TCP connection has been successfully established, where the smart device is configured as a client of the TCP connection, and the mobile terminal is configured as a server of the TCP connection;
the intelligent device is further used for informing the Wi-Fi bottom layer component to close the Wi-Fi hotspot of the intelligent device by using the Wi-Fi application layer component.
16. The apparatus of claim 15, further comprising:
the device comprises a sending module, a receiving module and a sending module, wherein the sending module is used for sending an access request message to the intelligent device, and the access request message is used for requesting to access a Wi-Fi hotspot of the intelligent device;
and the second receiving module is used for receiving the address information distributed by the Wi-Fi bottom layer component of the intelligent equipment responding to the access request message.
17. The apparatus of claim 16, further comprising:
the scanning module is used for scanning the Wi-Fi hotspots of the intelligent equipment and recording the identification information of the Wi-Fi hotspots of the intelligent equipment into a local cache;
and the configuration module is used for configuring the mobile terminal as a service end of the TCP connection if the Wi-Fi hotspot of the intelligent equipment to be accessed currently is determined to be a hotspot connected for the first time.
18. The apparatus of claim 15, further comprising:
and the processing module is used for disconnecting the Wi-Fi hotspot of the router and re-accessing the Wi-Fi hotspot of the intelligent device if the mobile terminal is determined to abnormally access the Wi-Fi hotspot of the router under the condition that the data communication between the intelligent device and the mobile terminal is not started or the data transmission is not finished, so that the intelligent device and the mobile terminal can perform data communication again.
19. A data communication system, comprising: intelligent equipment and a mobile terminal;
the intelligent device is configured as a client of a Transmission Control Protocol (TCP) connection and comprises: a data communication device as claimed in any one of claims 10 to 14;
the mobile terminal is configured as a server of the TCP connection, and comprises: a data communications device as claimed in any one of claims 15 to 18.
CN201911067422.XA 2019-11-04 2019-11-04 Data communication method, device and system Active CN110784939B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911067422.XA CN110784939B (en) 2019-11-04 2019-11-04 Data communication method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911067422.XA CN110784939B (en) 2019-11-04 2019-11-04 Data communication method, device and system

Publications (2)

Publication Number Publication Date
CN110784939A CN110784939A (en) 2020-02-11
CN110784939B true CN110784939B (en) 2022-01-21

Family

ID=69389173

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911067422.XA Active CN110784939B (en) 2019-11-04 2019-11-04 Data communication method, device and system

Country Status (1)

Country Link
CN (1) CN110784939B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111586714B (en) * 2020-04-21 2021-07-20 珠海格力电器股份有限公司 Network port allocation method, device, electronic equipment and computer usable medium
CN113114798B (en) * 2021-04-22 2022-05-10 荣耀终端有限公司 Method for acquiring Internet protocol IP address and electronic equipment
CN113242590A (en) * 2021-04-23 2021-08-10 行云新能科技(深圳)有限公司 WiFi module connection method, terminal and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102882938A (en) * 2012-09-10 2013-01-16 广东欧珀移动通信有限公司 Data share method and mobile terminal
CN105554062A (en) * 2015-11-30 2016-05-04 东莞酷派软件技术有限公司 Method, associated device and system of file transmission

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10298642B2 (en) * 2016-02-17 2019-05-21 Quickbiz Holdings Limited, Apia User interface content state synchronization across devices

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102882938A (en) * 2012-09-10 2013-01-16 广东欧珀移动通信有限公司 Data share method and mobile terminal
CN105554062A (en) * 2015-11-30 2016-05-04 东莞酷派软件技术有限公司 Method, associated device and system of file transmission

Also Published As

Publication number Publication date
CN110784939A (en) 2020-02-11

Similar Documents

Publication Publication Date Title
CN110784939B (en) Data communication method, device and system
CN103139529B (en) Video call switching method between sip server, video call device
CN106851782B (en) Data transmission method and device
CN107360635B (en) Data transmission method, device, terminal and computer readable storage medium
CN102571996B (en) IP (Internet Protocol) address assignment method, IP address assignment device and network system
US10708739B2 (en) Selectively transferring one or more services in multi-subscriber identity module (SIM)-multi-standby electronic device
CN110996361B (en) Data network switching method and device, mobile terminal and storage medium
CN102821150B (en) Based on application management method and the Cloud Server of cloud service
EP3742785A1 (en) Session management method and device
US10908889B2 (en) Method, user equipment, and application server for downloading application
CN106210023B (en) Virtual SIM card synchronous management method and terminal
CN110381057B (en) Communication connection processing method, device, storage medium, processor and system
CN104869665A (en) Network connection control method, router and mobile equipment
EP3267655A1 (en) Multi-terminal interaction relation maintenance system and method
CN112187486B (en) Interaction method between intelligent devices and intelligent device
CN104797004A (en) Method for implementation of automatic networking between master and slave devices
JP2017528017A (en) Method, apparatus and system for managing mobile hotspots
CN116567342A (en) Screen projection method and device
CN107920372B (en) Information indication method and device
EP3048858A1 (en) Wireless customer premise equipment and accessing method therefor
CN108551429A (en) Flow control methods, electronic device and the computer readable storage medium of application program
AU2018407192A1 (en) Resource configuration method and device, and computer storage medium
CN113691427A (en) Network distribution method, first device, second device, network distribution system and processor
CN114124595A (en) Method for connecting household electrical appliance to network
CN105191460A (en) Information transmission method, device, and system

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
GR01 Patent grant
GR01 Patent grant