Communication method and device and storage medium

By sending DHCP discovery packets in WIFI roaming events and requesting a new IP address, the problem of network disconnection during WIFI roaming is solved, and the network communication stability and reliability of the device are improved.

CN119449768APending Publication Date: 2025-02-14BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310974913.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-03
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

During WIFI roaming, the terminal device may have network disconnection, affecting the normal use of the user.

Method used

When the device triggers a WIFI roaming event, it obtains the current IP address and sends a DHCP discovery message in the WIFI roaming network. The DHCP packet is received from the first gateway. If the second address is different from the first address, a new IP address is requested from the first gateway and communication is carried out according to the new IP address.

Benefits of technology

Through this method, the stability and reliability of device network communication can be improved and the network disconnection phenomenon can be reduced when the device roams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449768A_ABST
    Figure CN119449768A_ABST
Patent Text Reader

Abstract

The invention relates to a communication method and device and a storage medium, and belongs to the technical field of communication, and the method comprises the steps: responding to a wireless fidelity WIFI roaming event triggered by equipment, obtaining a current IP address of the equipment, and obtaining a first address; a DHCP discovery message is sent in the WIFI roaming network; receiving a DHCP provision message sent by a first gateway and used for responding to the DHCP discovery message, wherein the DHCP provision message comprises a second address allocated by the first gateway for the device; under the condition that the first address is different from the second address, requesting a new IP address for equipment communication from the first gateway; and performing communication according to the new IP address. Therefore, the stability and reliability of network communication of the equipment can be improved, and the network disconnection phenomenon during roaming of the equipment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication technology, and in particular to a communication method, device and storage medium. Background Art

[0002] In WIFI (Wireless Fidelity) technology, terminal devices can obtain network services by connecting to wireless access points. However, the coverage of wireless access points is limited, and the terminal device may leave the coverage of the wireless access point. In this case, a new wireless access point can be set up to take over the network, so that the terminal device can connect to the new wireless access point and maintain its original Internet service. The process of switching from one wireless access point to another and maintaining network connection is called roaming.

[0003] However, in relevant scenarios, the terminal device may be disconnected from the network during WIFI roaming, thereby affecting the normal use of the user. Summary of the invention

[0004] In order to overcome the problems existing in the related art, the present disclosure provides a communication method, device and storage medium.

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a communication method, including:

[0006] In response to a WIFI roaming event being triggered by a device, acquiring a current IP address of the device to obtain a first address;

[0007] Send DHCP discovery message in WIFI roaming network;

[0008] receiving a DHCP offer message sent by a first gateway in response to the DHCP discover message, wherein the DHCP offer message includes a second address allocated by the first gateway to the device;

[0009] In the case where the first address is different from the second address, requesting a new IP address for communication with the device from the first gateway;

[0010] Communication is performed according to the new IP address.

[0011] Optionally, the sending of a DHCP discovery message in a WIFI roaming network includes:

[0012] The first address is used as the request address of the DHCP discovery message, and the DHCP discovery message is sent in the WIFI roaming network.

[0013] Optionally include:

[0014] When the first address is the same as the second address, sending a DHCP request message for requesting the first address to the first gateway;

[0015] Receive a DHCP confirmation message sent by the first gateway.

[0016] Optionally, the method comprises:

[0017] Acquire the address of the first gateway according to the DHCP provision message to obtain a third address;

[0018] The step of requesting a new IP address for communication with the device from the first gateway when the first address is different from the second address includes:

[0019] When the first address is different from the second address and the third address is different from the fourth address, a new IP address for communication with the device is requested from the first gateway, and the fourth address is the address of the gateway used by the device in the previous communication.

[0020] Optionally include:

[0021] When the first address is the same as the second address, and the third address is the same as the fourth address, sending a DHCP request message for requesting the first address to the first gateway;

[0022] Receive a DHCP confirmation message sent by the first gateway.

[0023] Optionally include:

[0024] Acquire the address of the first gateway according to the DHCP provision message to obtain a third address;

[0025] In the case that the third address is different from the fourth address, a new IP address for communication with the device is requested from the first gateway, and the fourth address is the address of the gateway used by the device in the previous communication.

[0026] Optionally, the requesting the first gateway for a new IP address for communication with the device includes:

[0027] Based on the second address, sending a target DHCP request message to the first gateway;

[0028] In response to receiving a target DHCP confirmation message sent by the first gateway in response to the target DHCP request message, the second address is used as a new IP address for communication with the device.

[0029] According to a second aspect of an embodiment of the present disclosure, there is provided a communication device, including:

[0030] A first acquisition module is configured to acquire a current IP address of the device in response to a WIFI roaming event being triggered by the device, thereby obtaining a first address;

[0031] A first sending module is configured to send a DHCP discovery message in a WIFI roaming network;

[0032] A first receiving module is configured to receive a DHCP offer message sent by a first gateway in response to the DHCP discover message, wherein the DHCP offer message includes a second address allocated by the first gateway to the device;

[0033] a first execution module, configured to request a new IP address for communication with the device from the first gateway when the first address is different from the second address;

[0034] The communication module is configured to communicate according to the new IP address.

[0035] Optionally, the first sending module includes:

[0036] The first sending submodule is configured to use the first address as a request address of the DHCP discovery message and send the DHCP discovery message in a WIFI roaming network.

[0037] Optionally, the device comprises:

[0038] a second sending module, configured to send a DHCP request message for requesting the first address to the first gateway when the first address is the same as the second address;

[0039] The second receiving module is configured to receive the DHCP confirmation message sent by the first gateway.

[0040] Optionally, the device comprises:

[0041] A third address acquisition module is configured to acquire the address of the first gateway according to the DHCP provision message to obtain a third address;

[0042] The first execution module includes:

[0043] The first execution submodule is configured to request a new IP address for communication with the device from the first gateway when the first address is different from the second address and the third address is different from the fourth address, and the fourth address is the address of the gateway used by the device in the previous communication.

[0044] Optionally, the device comprises:

[0045] A second execution module is configured to send a DHCP request message for requesting the first address to the first gateway when the first address is the same as the second address and the third address is the same as the fourth address;

[0046] The third receiving module is configured to receive the DHCP confirmation message sent by the first gateway.

[0047] Optionally, the device comprises:

[0048] An address acquisition module, configured to acquire the address of the first gateway according to the DHCP provision message to obtain a third address;

[0049] The third execution module is configured to request a new IP address for communication of the device from the first gateway when the third address is different from a fourth address, and the fourth address is the address of the gateway used by the device in the previous communication.

[0050] Optionally, the requesting the first gateway for a new IP address for communication with the device includes:

[0051] Based on the second address, sending a target DHCP request message to the first gateway;

[0052] In response to receiving a target DHCP confirmation message sent by the first gateway in response to the target DHCP request message, the second address is used as a new IP address for communication with the device.

[0053] According to a third aspect of an embodiment of the present disclosure, a communication device is provided, including:

[0054] processor;

[0055] a memory for storing processor-executable instructions;

[0056] The processor is configured to execute the steps of any method described in the first aspect above.

[0057] According to a fourth aspect of an embodiment of the present disclosure, there is provided a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the steps of any one of the methods described in the first aspect above.

[0058] By adopting the above technical solution, when a device triggers a WIFI roaming event, the device can send a DHCP discovery message in the WIFI roaming network and receive a DHCP offer message in response to the DHCP discovery message. When the second address in the DHCP offer message is different from the first address of the device, the device can determine that the network communication is abnormal or the device has roamed across subnets. In this way, the device can request a new IP address for the device communication from the first gateway and communicate according to the new IP address. In this way, the stability and reliability of the device network communication can be improved, and the phenomenon of network disconnection during device roaming can be reduced.

[0059] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0061] Figure 1 The present invention is a flow chart showing a communication method according to an exemplary embodiment.

[0062] Figure 2 The present invention is a flow chart showing a communication method according to an exemplary embodiment.

[0063] Figure 3 According to an exemplary embodiment, Figure 1 Flowchart of how the device in obtains the IP address.

[0064] Figure 4 The present invention is a flowchart showing a method for a device to obtain an IP address according to an exemplary embodiment.

[0065] Figure 5 The present invention is a flow chart showing a communication method according to an exemplary embodiment.

[0066] Figure 6 It is a block diagram of a communication device according to an exemplary embodiment.

[0067] Figure 7 It is a block diagram of a device 800 for communication according to an exemplary embodiment. DETAILED DESCRIPTION

[0068] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0069] Before introducing the communication method, device, and storage medium of the present disclosure, the application scenarios of the embodiments of the present disclosure are first introduced.

[0070] In related scenarios, a WIFI roaming network consisting of multiple APs (Access Points) can be set up. The multiple APs can be located in different network segments, and each network segment can be correspondingly provided with a gateway. In this way, when a device accesses the WIFI roaming network, the device can perform WIFI roaming according to the signal strength of each AP.

[0071] As an example, the device can roam from AP1 to AP2. The AP1 is located in network segment 1, the gateway of network segment 1 is gateway 1, and the AP2 is located in network segment 2, the gateway of network segment 2 is gateway 2. After WIFI roaming, the device can send ARP (Address Resolution Protocol) messages for network detection.

[0072] Since the gateway information saved by the device is the gateway 1 corresponding to AP1 before roaming, the device can send an ARP message to the gateway 1. However, after roaming, the device is already in the network segment of gateway 2, so the ARP message cannot be transmitted to gateway 1, and the device cannot receive a response message to the ARP message. In this way, based on the roaming mechanism of the device, the device may be disconnected from the network, which affects the user.

[0073] For example, in Google's roaming policy, if the device does not receive a response message to an ARP message, the NUD_FAILED mechanism may be triggered, causing the device to disconnect and reconnect to the currently connected router. At this time, users who are browsing web pages or playing games may feel the network interruption, resulting in a poor Internet experience.

[0074] For this purpose, refer to Figure 1The flowchart of a communication method shown in the figure, in some implementation scenarios, after the device accesses the wifi roaming network, it can save the current gateway information. When the roaming is triggered, the device can also actively send a ping packet to the gateway after the roaming reassociation is completed to determine whether cross-subnet roaming occurs. For example, a threshold time can be set. If the gateway replies to the ping packet within the threshold time, the device can determine that cross-subnet roaming does not occur. At this time, the device does not need to perform any processing.

[0075] In addition, when the gateway does not reply to the ping packet within the threshold time, the device can also send a DHCP (Dynamic Host Configuration Protocol) discovery message to the network. The gateway in the network can respond to the DHCP discovery message (also called DHCP Discovery message) and send a DHCP offer message (also called DHCP Offer message) to the device.

[0076] In this way, the device can receive and parse the DHCP offer message to obtain current gateway information, such as the address of the gateway. The device can also compare the gateway address in the DHCP offer message with the saved gateway address. When the gateway address changes, it can be determined that cross-subnet roaming occurs. At this time, the device can re-execute the DHCP process of obtaining an IP address, and then re-acquire the IP address. When the gateway address does not change, the device can determine that cross-subnet roaming does not occur. At this time, the device can do nothing.

[0077] The above solution can determine whether cross-subnet roaming occurs by comparing whether the gateway address has changed. However, the applicant has found that in some implementation scenarios, there may be a phenomenon where multiple gateways have the same address but different subnets. Figure 1 This situation may be considered as non-cross-subnet roaming, which will eventually cause the device to be unable to connect to the Internet.

[0078] In addition, Figure 1 In the case of a device that is not roaming across subnets, no additional processing is performed on the device. However, in some scenarios, this approach may cause the device to be unable to use the network. In addition, in some scenarios, even if the device does not roam across subnets, the gateway may assign a different IP address to the device when responding to a DHCP discovery message, which may eventually lead to abnormal device network connection, such as failure to access the network through WIFI.

[0079] To this end, an embodiment of the present disclosure provides a communication method. Figure 2FIG. 1 is a flow chart of a communication method according to an exemplary embodiment. The method can be used in various devices, such as mobile phones, tablet computers, wearable devices (such as watches, bracelets), etc. Figure 2 As shown, the method may include the following steps:

[0080] In step S21, in response to the device triggering a WIFI roaming event, the current IP address of the device is acquired to obtain a first address.

[0081] Here we take Android devices as an example Figure 2 When the Android device is roaming, the WIFI state machine of the application framework layer can receive the ASSOCIATED_BSSID_EVENT event notification. In this way, the Android device can obtain the current IP address of the device and obtain the first address.

[0082] In step S22, a DHCP discovery message is sent in the WIFI roaming network.

[0083] Continuing with the above example, the Android device can, for example, send a DHCP discovery message in the WIFI roaming network when the roaming reassociation is completed. The DHCP discovery message can be a broadcast message, so that the host in the network segment where the Android device is located can receive the DHCP discovery message. When the gateway in the network receives the DHCP discovery message, the gateway can generate a DHCP offer message for responding to the DHCP discovery message, and send the DHCP offer message to the Android device.

[0084] In step S23, a DHCP offer message sent by the first gateway in response to the DHCP discover message is received, where the DHCP offer message includes the second address allocated by the first gateway to the device.

[0085] Here, the second address is exemplarily described.

[0086] It should be understood that in a scenario where the device does not roam across subnets, the gateway used by the device for communication does not change. That is, the first gateway is consistent with the gateway saved by the device, and the current IP address of the device belongs to the address pool of the first gateway. In this way, when the first gateway responds to the DHCP discovery message, it can assign the same address as the current IP address of the device to the device.

[0087] In the scenario where the device roams across subnets, the gateway used for device communication changes. That is, the first gateway is inconsistent with the gateway saved by the device. At this time, the current IP address of the device does not belong to the address pool of the first gateway. Therefore, the first gateway can allocate an available IP address to the device based on its own address pool.

[0088] In step S24, when the first address is different from the second address, a new IP address for device communication is requested from the first gateway.

[0089] When the first address and the second address are different, it can be determined that the device is roaming across subnets or a communication anomaly occurs. Therefore, the device can request a new IP address from the first gateway to ensure the normal use of the communication function.

[0090] As an example, requesting the first gateway for a new IP address for device communication includes:

[0091] Based on the second address, sending a target DHCP request message to the first gateway;

[0092] In response to receiving a target DHCP confirmation message sent by the first gateway in response to the target DHCP request message, the second address is used as a new IP address for communication with the device.

[0093] Figure 3 This is an exemplary embodiment of the present disclosure. Figure 1 Flowchart of how the device obtains the IP address. Figure 3 ,exist Figure 1 In the scenario, after the device is determined to be roaming across subnets through the DHCP offer message, the steps for obtaining an IP address specified in the DHCP protocol can be re-executed, that is, "the device resends a DHCP discovery message -> the gateway sends a DHCP offer message -> the device sends a DHCP request message -> the gateway replies with a DHCP confirmation message".

[0094] Reference Figure 3 , where the device resends the DHCP discovery message and the gateway sends the DHCP offer message, which is redundant and increases the communication overhead. Figure 4 A flowchart of a device obtaining an IP address is shown. In an embodiment of the present disclosure, when the first address and the second address are different, a target DHCP request message can be sent to the first gateway based on the second address. And, in response to receiving a target DHCP confirmation message sent by the first gateway to respond to the target DHCP request message, the second address is used as a new IP address for communication of the device.

[0095] In this way, the steps for the device to obtain an IP address can be shortened, thereby reducing communication overhead and shortening network recovery time.

[0096] After obtaining the new IP address, in step S25, communication is performed according to the new IP address.

[0097] As an example, the device may communicate across sub-networks based on the IP address and the first gateway.

[0098] By adopting the above technical solution, when a device triggers a WIFI roaming event, the device can send a DHCP discovery message in the WIFI roaming network and receive a DHCP offer message in response to the DHCP discovery message. When the second address in the DHCP offer message is different from the first address of the device, the device can determine that the network communication is abnormal or the device has roamed across subnets. In this way, the device can request a new IP address for the device communication from the first gateway and communicate according to the new IP address. In this way, the stability and reliability of the device network communication can be improved.

[0099] Furthermore, the above solution can determine whether cross-subnet roaming occurs by comparing IP addresses. Therefore, even in a scenario where the gateway addresses are the same but the gateway subnets are different, the above solution can be used to determine whether cross-subnet roaming occurs and whether the IP address needs to be re-acquired. Figure 1 The above technical solution has higher recognition accuracy and higher network communication stability.

[0100] In a possible implementation, it is also possible to determine whether the device crosses subnets based on the gateway address. In this case, the method Figure 2 On this basis, it may also include:

[0101] Acquire the address of the first gateway according to the DHCP provision message to obtain a third address;

[0102] In the case that the third address is different from the fourth address, a new IP address for communication with the device is requested from the first gateway, and the fourth address is the address of the gateway used by the device in the previous communication.

[0103] It should be understood that when the third address and the fourth address are different, it means that the gateway relied on by the device in the previous communication is inconsistent with the gateway currently sending the DHCP offer message. Therefore, the device can determine that it is in a cross-subnet roaming scenario, and the device can request a new IP address for the device communication from the first gateway.

[0104] In a possible implementation, the device may also determine whether it is necessary to reacquire a new IP address by combining the first address, the second address, the third address, and the fourth address. Figure 2 Based on the method shown, it can also include:

[0105] Acquire the address of the first gateway according to the DHCP provision message to obtain a third address;

[0106] Reference Figure 2 , when the first address is different from the second address, requesting a new IP address for device communication from the first gateway includes:

[0107] When the first address is different from the second address and the third address is different from the fourth address, a new IP address for communication with the device is requested from the first gateway, and the fourth address is the address of the gateway used by the device in the previous communication.

[0108] When the third address and the fourth address are different, it means that the gateway relied on by the device in the previous communication is inconsistent with the gateway currently sending the DHCP offer message. When the first address and the second address are different, it means that the current IP address of the device is inconsistent with the IP address assigned to it by the first gateway. At this time, the device may roam across subnets.

[0109] That is, in the above solution, the device can combine the change of its own IP address and the change of the gateway address to comprehensively determine whether cross-subnet roaming occurs and whether a new communication IP address needs to be obtained. In this way, the accuracy of the identification result of cross-subnet roaming can be improved.

[0110] It should be noted that in some scenarios, even if the device does not roam across subnets, the gateway may assign different IP addresses to the device when responding to the DHCP discovery message, which may eventually cause the device to have an abnormal network connection.

[0111] To this end, in a possible implementation manner, the sending of a DHCP discovery message in a WIFI roaming network (step S22) includes:

[0112] The first address is used as the request address of the DHCP discovery message, and the DHCP discovery message is sent in the WIFI roaming network.

[0113] That is, a DHCP discovery message specifying a request for the first address can be sent in a WIFI roaming network. In this way, when responding to the DHCP discovery message, the first gateway can confirm whether the first address is in its own address pool. If the first address is in the address pool of the first gateway, the device does not roam across subnets, and the first gateway can allocate the first address to the device. If the first address is not in the address pool of the first gateway, the device roams across subnets, and the first gateway can allocate the address to the device based on its own address pool.

[0114] In the above solution, the device can send a DHCP discovery message specifying its own address. In this way, in a scenario where the subnet is not crossed, the gateway can assign the device the address specified by the device. In this way, the consistency of the device address and the address assigned by the gateway can be guaranteed, thereby avoiding abnormal network connection.

[0115] In addition, refer to Figure 1 In relevant scenarios, it is possible to determine that the device is not roaming across subnets through DHCP discovery messages and DHCP offer messages, and no additional processing is performed on the device at this time. The applicant found that when determining that the device is not roaming across subnets, it relies on the steps of sending DHCP discovery messages and receiving DHCP offer messages, and no other processing is performed when the device is not roaming across subnets. Therefore, some steps specified in the DHCP protocol are executed in this solution. However, since the steps specified in the DHCP protocol are not fully executed, the device may not be able to connect to the Internet in some scenarios.

[0116] To this end, in a possible implementation manner, the communication method provided in the embodiment of the present disclosure is Figure 2 On the basis of:

[0117] When the first address is the same as the second address, sending a DHCP request message for requesting the first address to the first gateway;

[0118] Receive a DHCP confirmation message sent by the first gateway.

[0119] In the above solution, even if the first address is the same as the second address, the subsequent steps in the DHCP protocol are executed. In this way, the phenomenon that the device cannot be connected to the network due to the steps specified in the DHCP protocol not being fully executed can be avoided.

[0120] Similarly, in an implementation scenario where the first address, the second address, the third address, and the fourth address are combined to determine whether a new IP address needs to be re-acquired, the method may further include:

[0121] When the first address is the same as the second address, and the third address is the same as the fourth address, sending a DHCP request message for requesting the first address to the first gateway;

[0122] Receive a DHCP confirmation message sent by the first gateway.

[0123] In the above solution, even if it is determined that the device does not roam across subnets, the subsequent steps in the DHCP protocol are executed. In this way, the phenomenon that the device cannot connect to the Internet due to the steps specified in the DHCP protocol not being fully executed can be avoided.

[0124] Figure 5 FIG. 1 is a flow chart of a communication method according to an exemplary embodiment. The method can be used in various devices, such as mobile phones, tablet computers, wearable devices, etc. Figure 5 As shown, the method may include the following steps:

[0125] After the device accesses the Wi-Fi roaming network, it saves the current gateway information.

[0126] When roaming is triggered, the device can actively send a DHCP discovery message including its own IP after roaming reassociation is completed. When the gateway in the network receives the DHCP discovery message, it can respond to the DHCP discovery message. For example, the gateway can confirm whether the IP is located in its own address pool. If the IP is in its own address pool, the device has not roamed across subnets, and the gateway can allocate the IP to the device. If the IP is not in the address pool of the gateway, the device has roamed across subnets, and the gateway can allocate an available IP to the device based on its own address pool.

[0127] The gateway may also generate a DHCP offer message for responding to the DHCP discover message according to the allocated address, and send the DHCP offer message to the device.

[0128] After receiving the DHCP offer message, the device can parse the DHCP offer message to obtain the address of the gateway and the IP assigned to the device by the gateway. The device can also compare the obtained gateway address with the current gateway address stored in itself, and the device can also compare its own IP with the IP assigned by the gateway.

[0129] When the acquired gateway address is consistent with the current gateway address saved by itself, and its own IP is consistent with the IP assigned by the gateway, the device can determine that it is not roaming across subnets. Therefore, the device can send a DHCP request message requesting its own IP and receive a DHCP confirmation message from the gateway to renew the lease.

[0130] The above solution also executes the subsequent steps in the DHCP protocol when it is determined that the device is not roaming across subnets. In this way, it is possible to avoid the phenomenon that the device cannot be connected to the Internet due to the steps specified in the DHCP protocol not being fully executed.

[0131] Reference Figure 5 When the acquired gateway address is inconsistent with the current gateway address stored in the device, and / or the device's own IP is inconsistent with the IP assigned by the gateway, the device can send a DHCP request message to request a new IP address.

[0132] This method can directly send a DHCP request message without repeatedly executing the steps of sending a DHCP discovery message and receiving a DHCP offer message, and has the advantages of faster speed and less resource consumption.

[0133] Reference Figure 5 , the device can also receive the DHCP confirmation message replied by the gateway, thereby updating its own IP address. In this way, the device re-acquires a new IP address and can communicate based on the new IP address, and there is no network disconnection during the whole process. Therefore, the above solution helps to improve the stability and reliability of device network communication.

[0134] Based on the same inventive concept, the present disclosure also provides a communication device. Figure 6 is a block diagram of a communication device shown in an exemplary embodiment of the present disclosure, referring to Figure 6 , the communication device comprises:

[0135] The first acquisition module 601 is configured to acquire the current IP address of the device in response to the device triggering a WIFI roaming event, and obtain a first address;

[0136] The first sending module 602 is configured to send a DHCP discovery message in a WIFI roaming network;

[0137] A first receiving module 603 is configured to receive a DHCP offer message sent by a first gateway in response to the DHCP discover message, wherein the DHCP offer message includes a second address allocated by the first gateway to the device;

[0138] A first execution module 604 is configured to request a new IP address for communication with the device from the first gateway when the first address is different from the second address;

[0139] The communication module 605 is configured to communicate according to the new IP address.

[0140] By adopting the above technical solution, when a device triggers a WIFI roaming event, the device can send a DHCP discovery message in the WIFI roaming network and receive a DHCP offer message in response to the DHCP discovery message. When the second address in the DHCP offer message is different from the first address of the device, the device can determine that the network communication is abnormal or the device has roamed across subnets. In this way, the device can request a new IP address for the device communication from the first gateway and communicate according to the new IP address. In this way, the stability and reliability of the device network communication can be improved, and the phenomenon of network disconnection during device roaming can be reduced.

[0141] Optionally, the first sending module 602 includes:

[0142] The first sending submodule is configured to use the first address as a request address of the DHCP discovery message and send the DHCP discovery message in a WIFI roaming network.

[0143] Optionally, the device comprises:

[0144] a second sending module, configured to send a DHCP request message for requesting the first address to the first gateway when the first address is the same as the second address;

[0145] The second receiving module is configured to receive the DHCP confirmation message sent by the first gateway.

[0146] Optionally, the device comprises:

[0147] A third address acquisition module is configured to acquire the address of the first gateway according to the DHCP provision message to obtain a third address;

[0148] The first execution module 604 includes:

[0149] The first execution submodule is configured to request a new IP address for communication with the device from the first gateway when the first address is different from the second address and the third address is different from the fourth address, and the fourth address is the address of the gateway used by the device in the previous communication.

[0150] Optionally, the device comprises:

[0151] A second execution module is configured to send a DHCP request message for requesting the first address to the first gateway when the first address is the same as the second address and the third address is the same as the fourth address;

[0152] The third receiving module is configured to receive the DHCP confirmation message sent by the first gateway.

[0153] Optionally, the device comprises:

[0154] An address acquisition module, configured to acquire the address of the first gateway according to the DHCP provision message to obtain a third address;

[0155] The third execution module is configured to request a new IP address for communication of the device from the first gateway when the third address is different from a fourth address, and the fourth address is the address of the gateway used by the device in the previous communication.

[0156] Optionally, the requesting the first gateway for a new IP address for communication with the device includes:

[0157] Based on the second address, sending a target DHCP request message to the first gateway;

[0158] In response to receiving a target DHCP confirmation message sent by the first gateway in response to the target DHCP request message, the second address is used as a new IP address for communication with the device.

[0159] The present disclosure also provides a communication device, including:

[0160] processor;

[0161] a memory for storing processor-executable instructions;

[0162] The processor is configured to execute the steps of the communication method provided in the embodiment of the present disclosure.

[0163] The embodiment of the present disclosure further provides a computer-readable storage medium on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the communication method provided in the embodiment of the present disclosure are implemented.

[0164] Regarding the communication device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0165] Figure 7 8 is a block diagram of a device 800 for communication according to an exemplary embodiment. For example, the device 800 may be a mobile phone, a tablet device, etc.

[0166] Reference Figure 7 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output interface 812 , a sensor component 814 , and a communication component 816 .

[0167] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned communication method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0168] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0169] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0170] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0171] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0172] The input / output interface 812 provides an interface between the processing component 802 and the peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0173] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0174] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0175] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above-mentioned communication method.

[0176] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to complete the above communication method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0177] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program executable by a programmable device, and the computer program has a code portion for executing the above communication method when executed by the programmable device.

[0178] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0179] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A communication method, characterized in that: include: In response to a wireless fidelity WIFI roaming event being triggered by the device, acquiring a current IP address of the device to obtain a first address; Send Dynamic Host Configuration Protocol DHCP discovery messages in WiFi roaming networks; receiving a DHCP offer message sent by a first gateway in response to the DHCP discover message, wherein the DHCP offer message includes a second address allocated by the first gateway to the device; In the case where the first address is different from the second address, requesting a new IP address for communication with the device from the first gateway; Communication is performed according to the new IP address.

2. The method according to claim 1, characterized in that The sending of a Dynamic Host Configuration Protocol DHCP discovery message in a WIFI roaming network includes: The first address is used as the request address of the DHCP discovery message, and the DHCP discovery message is sent in the WIFI roaming network.

3. The method according to claim 1, characterized in that include: When the first address is the same as the second address, sending a DHCP request message for requesting the first address to the first gateway; Receive a DHCP confirmation message sent by the first gateway.

4. The method according to claim 1, characterized in that: include: Acquire the address of the first gateway according to the DHCP provision message to obtain a third address; The step of requesting a new IP address for communication with the device from the first gateway when the first address is different from the second address includes: When the first address is different from the second address and the third address is different from the fourth address, a new IP address for communication with the device is requested from the first gateway, and the fourth address is the address of the gateway used by the device in the previous communication.

5. The method according to claim 4, characterized in that include: When the first address is the same as the second address, and the third address is the same as the fourth address, sending a DHCP request message for requesting the first address to the first gateway; Receive a DHCP confirmation message sent by the first gateway.

6. The method according to claim 1, characterized in that include: Acquire the address of the first gateway according to the DHCP provision message to obtain a third address; In the case that the third address is different from the fourth address, a new IP address for communication with the device is requested from the first gateway, and the fourth address is the address of the gateway used by the device in the previous communication.

7. The method according to any one of claims 1 to 6, characterized in that The requesting the first gateway for a new IP address for communication with the device includes: Based on the second address, sending a target DHCP request message to the first gateway; In response to receiving a target DHCP confirmation message sent by the first gateway in response to the target DHCP request message, the second address is used as a new IP address for communication with the device.

8. A communication device, characterized in that: include: A first acquisition module is configured to acquire a current IP address of the device in response to a WIFI roaming event being triggered by the device, thereby obtaining a first address; A first sending module is configured to send a DHCP discovery message in a WIFI roaming network; A first receiving module is configured to receive a DHCP offer message sent by a first gateway in response to the DHCP discover message, wherein the DHCP offer message includes a second address allocated by the first gateway to the device; a first execution module, configured to request a new IP address for communication with the device from the first gateway when the first address is different from the second address; The communication module is configured to communicate according to the new IP address.

9. A communication device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.