CN111884938A - Router information acquisition method and device - Google Patents

Router information acquisition method and device Download PDF

Info

Publication number
CN111884938A
CN111884938A CN202010617748.1A CN202010617748A CN111884938A CN 111884938 A CN111884938 A CN 111884938A CN 202010617748 A CN202010617748 A CN 202010617748A CN 111884938 A CN111884938 A CN 111884938A
Authority
CN
China
Prior art keywords
router
sending
socket
information
interface
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.)
Granted
Application number
CN202010617748.1A
Other languages
Chinese (zh)
Other versions
CN111884938B (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.)
Haier Uplus Intelligent Technology Beijing Co Ltd
Original Assignee
Haier Uplus Intelligent Technology Beijing 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 Haier Uplus Intelligent Technology Beijing Co Ltd filed Critical Haier Uplus Intelligent Technology Beijing Co Ltd
Priority to CN202010617748.1A priority Critical patent/CN111884938B/en
Publication of CN111884938A publication Critical patent/CN111884938A/en
Application granted granted Critical
Publication of CN111884938B publication Critical patent/CN111884938B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Abstract

The invention provides a router information acquisition method and a device, wherein the method comprises the following steps: acquiring an IP address of a router; establishing socket connection with the router according to the IP address; acquiring router information of the router through the socket sending interface; through the socket sending interface will router information is sent to the cloud server, the problem that in the application scene of the internet of things equipment in the related technology, the cloud server is difficult to acquire router information or even can not acquire router information can be solved, manual participation is not needed, the router information which is conveniently and efficiently acquired is achieved, and the router information is uniformly reported to a platform, so that the cloud server is convenient for processing the problem of the intelligent equipment which is related to the router and occurs in the using process.

Description

Router information acquisition method and device
Technical Field
The invention relates to the field of Internet of things, in particular to a router information acquisition method and device.
Background
With the development of the internet of things and intelligent hardware technology, a large number of wifi (wireless fidelity) internet of things intelligent devices enter the lives of people. The use scene of the internet of things equipment is that the equipment is accessed to a wireless router network in a user home through a self-contained WIFI module, and a network terminal (a mobile phone and the like) is controlled by means of wireless communication. The scene system mainly comprises a WIFI module, a router, a cloud end and a user terminal (such as a mobile phone).
The WIFI module is divided into 2 types:
1) the embedded WiFi module is designed based on MCU + WIFI, drive control of WIFI radio frequency is realized by the single chip microcomputer, and the embedded WiFi module is characterized by high integration level of software and hardware, and integrates a radio frequency transceiver, a Media Access Control (MAC) address, a WIFI drive and WIFI protocol (different applications and different integrated WIFI protocols), a wireless security protocol, a key connection and the like. The method is suitable for intelligent hardware singles and is used for low-cost Internet of things connection.
2) The standard Wi-Fi module is used for a WIFI module on a notebook computer and a tablet computer, and the WiFi protocol stack and the WIFI module driver run in android, Windows and other systems and can normally work only by completing application through a very powerful computer CPU.
Although the WIFI of the internet of things device and the router (AP for short) uses an embedded WIFI module scheme, the two have significant differences:
compared with a WIFI module used by the internet of things equipment, the WIFI module used by the router is based on a Linux-like operating system, and the function is powerful, and particularly the integrated WIFI protocol stack is comprehensive.
For the implementation of the details of the WIFI protocol stack part, the two parts may be different; in addition, the router implementation schemes in the current market are many, and the WIFI protocol stack part implementation of different router manufacturers is different.
The difference causes that the intelligent equipment is often related to a router in the home of a user when the intelligent equipment is found to be disconnected and fails to be controlled in the using process. To analyze such problems, first, the information of the router (specific model of the router) connected to the smart device needs to be collected.
Since the router is far away from the home of the user, there are generally the following methods for obtaining router information:
one is to go to the user site or contact the user directly to obtain the router information. But the users are located throughout the world and in many cases are not able to reach the users directly. And therefore this method is not generally available.
The other is that after the intelligent device WIFI is connected to the router, the Basic Service Set Identifier (BSSID) of the router can be acquired and reported to the cloud. The cloud can inquire the manufacturer of the router according to the BSSID of the router, but cannot acquire detailed information such as the specific model of the router.
Aiming at the problem that router information is difficult to acquire or even can not be acquired by a cloud server in an application scene of Internet of things equipment in the related art, no solution is provided.
Disclosure of Invention
The embodiment of the invention provides a router information acquisition method and device, and aims to at least solve the problem that in the application scene of Internet of things equipment in the related art, a cloud server is difficult to acquire router information or even cannot acquire the router information.
According to an embodiment of the present invention, there is provided a router information acquisition method, including:
acquiring an IP address of a router;
establishing socket connection with the router according to the IP address;
acquiring router information of the router through the socket sending interface;
and sending the router information to a cloud server through the socket sending interface.
Optionally, the obtaining of the router information of the router through the socket sending interface includes:
sending a request message for acquiring the router information to the router through a socket sending interface;
receiving a response message returned by the router, wherein the response message carries the router information;
and analyzing the response message to obtain the router information.
Optionally, sending, to the router through a socket sending interface, a request packet for obtaining the router information includes:
calling the socket sending interface, and sending the request message to the router;
and if the return value of the socket sending interface is less than 0, determining that the sending of the request message fails, and sending the request message in a preset time period until the request message is determined to be successfully sent.
Optionally, analyzing the response packet to obtain the router information includes:
determining an initial identifier from the response message according to a pre-negotiated message format, and recording the position of the initial identifier;
determining an end identifier of the response message from the initial position, and recording the position of the end identifier;
and acquiring data between the position of the starting identifier and the position of the ending identifier to obtain the router information.
Optionally, sending the router information to the cloud server through the socket sending interface includes:
establishing socket connection with the cloud server;
calling a socket sending interface, and sending data containing the router information to the cloud server;
and if the return value of the socket sending interface is less than 0, determining that the sending of the request message fails, and sending the request message in a preset time period until the request message is determined to be successfully sent.
Optionally, after the router information is sent to the cloud server through the socket sending interface, the method further includes:
calling a socket receiving interface, and receiving a confirmation message sent by the cloud server;
if the return value of the socket receiving interface is greater than or equal to 0, determining that the router information is reported successfully;
storing physical identification information of the router.
Optionally, before establishing a socket connection with the router according to the IP address, the method further includes:
acquiring physical identification information of the router according to the IP address;
and determining that the physical identification information of the router is different from the identification information of the pre-information.
According to another embodiment of the present invention, there is also provided a router information acquisition apparatus including:
the first acquisition module is used for acquiring the IP address of the router;
the establishing module is used for establishing socket connection with the router according to the IP address;
the second acquisition module is used for acquiring the router information of the router through the socket sending interface;
and the sending module is used for sending the router information to a cloud server through the socket sending interface.
Optionally, the second obtaining module includes:
the first sending submodule is used for sending a request message for acquiring the router information to the router through a socket sending interface;
the first receiving submodule is used for receiving a response message returned by the router, wherein the response message carries the router information;
and the analysis submodule is used for analyzing the response message to obtain the router information.
Optionally, the sending sub-module includes:
the sending unit is used for calling the socket sending interface and sending the request message to the router;
a first determining unit, configured to determine that the request packet is failed to be sent if a return value of the socket sending interface is less than 0, and send the request packet in a predetermined time period until it is determined that the request packet is successfully sent.
Optionally, the parsing sub-module includes:
a second determining unit, configured to determine an initial identifier from the response packet according to a pre-negotiated packet format, and record a position of the initial identifier;
a third determining unit, configured to determine, starting from the starting position, an end identifier of the response packet, and record a position of the end identifier;
and the acquisition unit is used for acquiring data between the position of the starting identifier and the position of the ending identifier to obtain the router information.
Optionally, the sending module includes:
the establishing submodule is used for establishing socket connection with the cloud server;
the second sending submodule is used for calling a socket sending interface and sending data containing the router information to the cloud server;
and the first determining submodule is used for determining that the request message is failed to be sent if the return value of the socket sending interface is less than 0, and sending the request message in a preset time period until the request message is determined to be successfully sent.
Optionally, the apparatus further comprises:
the second receiving submodule is used for calling a socket receiving interface and receiving a confirmation message sent by the cloud server;
the second determining submodule is used for determining that the router information is reported successfully if the return value of the socket receiving interface is greater than or equal to 0;
and the storage submodule is used for storing the physical identification information of the router.
Optionally, the apparatus further comprises:
a third obtaining module, configured to obtain physical identification information of the router according to the IP address;
and the determining module is used for determining that the physical identification information of the router is different from the identification information of the pre-information.
According to a further embodiment of the present invention, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to perform the steps of any of the above-described method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the invention, socket connection is established with the router according to the IP address; the socket sending interface is used for obtaining the router information, the router information is sent to the cloud server through the socket sending interface, the problem that the router information is difficult to obtain or even can not be obtained by the cloud server in the application scene of the Internet of things equipment in the related technology is solved, manual participation is not needed, the router information is conveniently and efficiently collected and reported to the cloud server in a unified mode, and the problem that the intelligent equipment is related to the router in the using process is convenient to process by the cloud server.
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 block diagram of a hardware structure of a mobile terminal of a router information acquisition method according to an embodiment of the present invention;
fig. 2 is a flowchart of a router information collection method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an internet of things device collecting router information according to an embodiment of the present invention;
fig. 4 is a block diagram of a router information collection apparatus according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
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.
Example 1
The method provided by the first embodiment of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking a mobile terminal as an example, fig. 1 is a hardware structure block diagram of the mobile terminal of the router information acquisition method according to the embodiment of the present invention, and as shown in fig. 1, the mobile terminal may include one or more processors 102 (only one is shown in fig. 1) (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 104 for storing data, and optionally, the mobile terminal may further include a transmission device 106 for a communication function and an input/output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program and a module of an application software, such as a computer program corresponding to the router information acquisition method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, so as to implement the method described above. The memory 104 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 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal 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 106 is used for receiving or transmitting 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 106 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 106 can be a Radio FrequeNcy (RF) module, which is used to communicate with the internet in a wireless manner.
Based on the foregoing mobile terminal or network architecture, in this embodiment, a router information collection method is provided, and fig. 2 is a flowchart of a router information collection method according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, obtaining the IP address of the router;
in an optional embodiment, the physical identification information of the router is obtained according to the IP address, and it is determined that the physical identification information of the router is different from the identification information of the pre-information, that is, it is determined that the router information of the router has not been reported before, and if the physical identification information of the router is the same as the identification information of the pre-information, it indicates that the router has been reported before, and the reporting is not repeated, and the pre-stored identification information may be stored in a FLASH. The physical identification information may be a Service Set Identifier (SSID), where the SSID is an address of an Access Point (AP), and is a unique physical identification of the AP.
A Transmission Control Protocol/internet Protocol (TCP/IP), which is a connection-oriented (connection-oriented) reliable Transport layer (Transport layer) communication Protocol based on byte stream; the Address Resolution Protocol (ARP) is a network layer Protocol for acquiring a MAC Address according to an IP Address.
Step S204, establishing socket connection with the router according to the IP address;
the socket is an abstraction layer through which an application can send or receive data, and transmits data using a TCP protocol, and a receiving end receives a data stream identical to that of a sending end. The sending end and the receiving end must establish contact so as to communicate on the basis of a TCP protocol, Socket sockets are generally used, when a service Socket waits for a service request (namely, connection establishment), the Socket of the client can require connection establishment, and once the connection is established, data can be transmitted in two directions.
Step S206, obtaining the router information of the router through the socket sending interface;
the router information includes model information of the router, a MAC address, basic information of the router, and the like, and specific information such as the model of the router can be seen on a shell of the router and can be acquired in the router management interface, and usually, the specific information is logged in the router management interface through a mobile phone or a computer in a manner of using an HTTP router to manage an IP (i.e., an IP address of the router).
And step S208, sending the router information to a cloud server through the socket sending interface.
The execution main body of the steps can be the Internet of things equipment which is provided with a WIFI functional module and can access the router.
By the invention, the IP address of the router is obtained; establishing socket connection with the router according to the IP address; acquiring the router information through the socket sending interface; through the socket sending interface will router information is sent to the cloud ware, can solve the difficult or even unable problem that obtains of router information of cloud ware acquisition in the thing networking device application scene among the correlation technique, do not need artifical the participation, has realized the router information of convenient, efficient collection and has reported to the cloud ware in unison for the cloud ware is convenient for handle the problem relevant with the router that smart machine appears in the use.
In an embodiment of the present invention, the step S206 may specifically include:
s2061, sending a request message for obtaining the router information to the router through a socket sending interface; further, calling the socket sending interface, and sending the request message to the router; and if the return value of the socket sending interface is less than 0, determining that the sending of the request message fails, and sending the request message in a preset time period until the request message is determined to be successfully sent.
S2062, receiving a response packet returned by the router, where the response packet carries the router information;
s2063, analyzing the response message to obtain the router information.
Further, the parsing process specifically includes: determining an initial identifier from the response message according to a pre-negotiated message format, and recording the position of the initial identifier; determining an end identifier of the response message from the initial position, and recording the position of the end identifier; and acquiring data between the position of the starting identifier and the position of the ending identifier to obtain the router information.
Specifically, the request message and the response message are HTTP messages, and HTTP is a simple request-response protocol, which operates on TCP and transfers data based on a TCP/IP communication protocol. The HTTP protocol works on a client-server architecture. The browser serves as an HTTP client to send all requests to an HTTP server, namely a WEB server, through the URL.
In an embodiment of the present invention, the step S208 may specifically include: establishing socket connection with the cloud server; calling a socket sending interface, and sending data containing the router information to the cloud server; and if the return value of the socket sending interface is less than 0, determining that the sending of the request message fails, and sending the request message in a preset time period until the request message is determined to be successfully sent.
Further, after the router information is sent to the cloud server through the socket sending interface, a socket receiving interface is called to receive a confirmation message sent by the cloud server; if the return value of the socket receiving interface is greater than or equal to 0, determining that the router information is reported successfully; storing physical identification information of the router. So as to ensure that the cloud server successfully receives the router information, and then stores the router information into the FLASH.
The predetermined time period in the embodiment of the present invention may be 1 minute, 2 minutes, and the like, and the specific value may be set according to actual conditions.
The following provides a detailed description of embodiments of the invention.
Fig. 3 is a schematic diagram of collecting router information by an internet of things device according to an embodiment of the present invention, and as shown in fig. 3, a WIFI module sends a login HTTP message to a router, receives an HTTP response message including AP information returned by the router, acquires the AP information through the HTTP response message, reports a TCP message including the AP information to a cloud server, and then the cloud server sends a TCP confirmation message to the WIFI module. The method specifically comprises the following steps:
in the embodiment of the present invention, there are 2 conditions for acquiring AP information:
1, the acquisition of the address and BSSID of the AP is realized by the existing TCP/IP standard communication protocol technology, and the specific process is as follows:
after the WIFI module is connected with the AP, the WIFI module can acquire the IP address of the AP according to a TCP/IP communication protocol, the mark is AP _ IP, and the AP _ IP has 2 functions:
establishing socket communication between the WIFI module and the AP and using the IP of the AP;
acquiring the BSSID of the AP requires using the IP of the AP.
After obtaining the AP _ IP, the module takes the AP _ IP as input, and in an Address Resolution Protocol (ARP), which is a TCP/IP protocol that obtains a physical Address according to an IP Address, the table finds the BSSID corresponding to the IP, that is, the BSSID of the AP.
2, connecting the router as a new router, comparing whether the AP BSSID stored by the WIFI module is consistent with the BSSID of the current router, if not, judging the AP as a new AP, and continuing the following process; if the information is consistent, the AP connected with the WIFI module is considered, the model information of the AP is reported, and the process is ended.
Acquiring AP information (mainly including router type information): the stage is a main stage and is divided into the following sub-stages, wherein the used data communication interface is a related interface of the existing standard TCP socket communication:
1, establishing socket connection, and establishing TCP socket connection between a module and an AP (access point) by using a management address AP _ IP of the AP, wherein the module is used as a socket client, and the AP is used as a socket server;
assembling a Hypertext Transfer Protocol (HTTP) message, and assembling an HTTP message for logging in an AP according to a format requirement of an HTTP Protocol, where the specific content of the message is as follows: "GET/HTTP/1.1\ r \ nUser-Agent: HAIER \ r \ nACCept:/r \ nHost: None \ r \ nConnection: Close \ r \ n";
3, sending an HTTP message, sending the HTTP message assembled in the second step to the router by using the socket send interface, if the return value of the socket send interface is less than 0, considering that the message sending is failed, and calling the socket send again to send the HTTP message after waiting for 1min until the message sending is successful;
4, receiving the HTTP message, calling a socket recv interface by the module to receive the HTTP message responded by the router after the HTTP message is successfully sent, and if the return value of the socket recv interface is less than 0, determining that the message is failed to be received, and waiting for 1min to perform the step 2 again;
5, analyzing the HTTP message, wherein the format of the AP model information in the message is as follows: the method comprises the following steps that < title > xxxxxx </title >, wherein < title > is a starting identifier, </title > is an ending identifier, and data xxxxxx between the starting identifier and the ending identifier is the specific model of the AP, for example, data < title > TL-WDR6500</title > exist in a message, and TL-WDR6500 is the specific model information of the AP. After the module receives the HTTP message responded by the AP, the message is analyzed according to the format, the AP model information is extracted, and the specific flow is as follows:
storing the received message into an RAM of a module, and recording as buff _ HTTP;
finding a starting identifier (< title >) in the buff _ HTTP, recording the position of the starting identifier in the buff _ HTTP, and recording as title _ start;
searching the position of an end identifier (</title >) from the position of the title _ start in the buff _ HTTP, and recording the position as title _ end;
taking out data between title _ start and title _ end from the buff _ HTTP; the model information of the AP is the detailed information of the model of the AP;
reporting the AP information, and after the AP model information is obtained, reporting the AP model information to a platform is realized at the stage, wherein the WIFI module and the cloud platform are in TCP communication, and the specific flow is as follows:
the module and the platform establish TCP socket connection, the module is used as a TCP client, and the platform is used as a TCP server;
the module calls a socket send interface to send data containing AP model information to the platform, if the send interface return value is less than 0, the sending is considered to be failed, and the data is sent again after 1 min; the other conditions are that the data transmission is successful, and the next step is continued;
data may be abnormally lost in network transmission, in order to ensure that the platform receives the data sent by the module, the module calls the socket recv interface to receive a confirmation message sent by the platform (the return value of the socket recv interface is not less than 0), the AP information is considered to be successfully reported, the AP _ BSSID is stored in the module FLASH, and the whole process is ended; otherwise, waiting for 1min and then repeating the previous step.
According to the embodiment of the invention, the model information of the router is obtained by sending the HTTP message of the login router to the router on the WIFI module by utilizing the application scene of the WIFI internet of things device, and the model information of the router is reported to the cloud platform, so that various compatibility problems of a user in the use of the internet of things device are analyzed. The scheme for acquiring the router information solves the problem that the router information is difficult to acquire or even can not be acquired in the application scene of the internet of things equipment, the scheme is software design, manual participation is not needed, the router information acquisition method has the characteristics of convenience, automation and high efficiency, and the acquired router information data are reported to a platform in a unified mode, so that data processing is convenient.
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.
Example 2
In this embodiment, a router information collecting device is further provided, and the device is used to implement the foregoing embodiments and preferred embodiments, and the description of the device that has been already made is omitted. 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. 4 is a block diagram of a router information collecting apparatus according to an embodiment of the present invention, as shown in fig. 4, including:
a first obtaining module 42, configured to obtain an IP address of a router;
the establishing module 44 is used for establishing socket connection with the router according to the IP address;
a second obtaining module 46, configured to obtain router information of the router through the socket sending interface;
and a sending module 48, configured to send the router information to a cloud server through the socket sending interface.
Optionally, the second obtaining module 46 includes:
the first sending submodule is used for sending a request message for acquiring the router information to the router through a socket sending interface;
the first receiving submodule is used for receiving a response message returned by the router, wherein the response message carries the router information;
and the analysis submodule is used for analyzing the response message to obtain the router information.
Optionally, the sending sub-module includes:
the sending unit is used for calling the socket sending interface and sending the request message to the router;
a first determining unit, configured to determine that the request packet is failed to be sent if a return value of the socket sending interface is less than 0, and send the request packet in a predetermined time period until it is determined that the request packet is successfully sent.
Optionally, the parsing sub-module includes:
a second determining unit, configured to determine an initial identifier from the response packet according to a pre-negotiated packet format, and record a position of the initial identifier;
a third determining unit, configured to determine, starting from the starting position, an end identifier of the response packet, and record a position of the end identifier;
and the acquisition unit is used for acquiring data between the position of the starting identifier and the position of the ending identifier to obtain the router information.
Optionally, the sending module 48 includes:
the establishing submodule is used for establishing socket connection with the cloud server;
the second sending submodule is used for calling a socket sending interface and sending data containing the router information to the cloud server;
and the first determining submodule is used for determining that the request message is failed to be sent if the return value of the socket sending interface is less than 0, and sending the request message in a preset time period until the request message is determined to be successfully sent.
Optionally, the apparatus further comprises:
the second receiving submodule is used for calling a socket receiving interface and receiving a confirmation message sent by the cloud server;
the second determining submodule is used for determining that the router information is reported successfully if the return value of the socket receiving interface is greater than or equal to 0;
and the storage submodule is used for storing the physical identification information of the router.
Optionally, the apparatus further comprises:
a third obtaining module, configured to obtain physical identification information of the router according to the IP address;
and the determining module is used for determining that the physical identification information of the router is different from the identification information of the pre-information.
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.
Example 3
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, acquiring the IP address of the router;
s2, establishing socket connection with the router according to the IP address;
s3, acquiring the router information of the router through the socket sending interface;
and S4, sending the router information to a cloud server through the socket sending interface.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-ONly Memory (ROM), a RaNdom Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, which can store computer programs.
Example 4
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, acquiring the IP address of the router;
s2, establishing socket connection with the router according to the IP address;
s3, acquiring the router information of the router through the socket sending interface;
and S4, sending the router information to a cloud server through the socket sending interface.
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.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A router information acquisition method is characterized by comprising the following steps:
acquiring an IP address of a router;
establishing socket connection with the router according to the IP address;
acquiring router information of the router through the socket sending interface;
and sending the router information to a cloud server through the socket sending interface.
2. The method of claim 1, wherein obtaining the router information of the router through the socket sending interface comprises:
sending a request message for acquiring the router information to the router through a socket sending interface;
receiving a response message returned by the router, wherein the response message carries the router information;
and analyzing the response message to obtain the router information.
3. The method of claim 2, wherein sending, to the router through a socket sending interface, a request message for obtaining the router information comprises:
calling the socket sending interface, and sending the request message to the router;
and if the return value of the socket sending interface is less than 0, determining that the sending of the request message fails, and sending the request message in a preset time period until the request message is determined to be successfully sent.
4. The method of claim 2, wherein parsing the response packet to obtain the router information comprises:
determining an initial identifier from the response message according to a pre-negotiated message format, and recording the position of the initial identifier;
determining an end identifier of the response message from the initial position, and recording the position of the end identifier;
and acquiring data between the position of the starting identifier and the position of the ending identifier to obtain the router information.
5. The method of claim 1, wherein sending the router information to the cloud server through the socket sending interface comprises:
establishing socket connection with the cloud server;
calling a socket sending interface, and sending data containing the router information to the cloud server;
and if the return value of the socket sending interface is less than 0, determining that the sending of the request message fails, and sending the request message in a preset time period until the request message is determined to be successfully sent.
6. The method of claim 5, wherein after sending the router information to the cloud server through the socket sending interface, the method further comprises:
calling a socket receiving interface, and receiving a confirmation message sent by the cloud server;
if the return value of the socket receiving interface is greater than or equal to 0, determining that the router information is reported successfully;
storing physical identification information of the router.
7. The method of any one of claims 1 to 6, wherein prior to establishing a socket connection with the router according to the IP address, the method further comprises:
acquiring physical identification information of the router according to the I P address;
and determining that the physical identification information of the router is different from the identification information of the pre-information.
8. A router information acquisition apparatus, comprising:
the first acquisition module is used for acquiring the IP address of the router;
the establishing module is used for establishing socket connection with the router according to the IP address;
the second acquisition module is used for acquiring the router information of the router through the socket sending interface;
and the sending module is used for sending the router information to a cloud server through the socket sending interface.
9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to carry out the method of any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 7.
CN202010617748.1A 2020-06-30 2020-06-30 Router information acquisition method and device Active CN111884938B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010617748.1A CN111884938B (en) 2020-06-30 2020-06-30 Router information acquisition method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010617748.1A CN111884938B (en) 2020-06-30 2020-06-30 Router information acquisition method and device

Publications (2)

Publication Number Publication Date
CN111884938A true CN111884938A (en) 2020-11-03
CN111884938B CN111884938B (en) 2022-12-30

Family

ID=73157338

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010617748.1A Active CN111884938B (en) 2020-06-30 2020-06-30 Router information acquisition method and device

Country Status (1)

Country Link
CN (1) CN111884938B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113691858A (en) * 2021-08-31 2021-11-23 Vidaa美国公司 Display device and interface display method
CN113709142A (en) * 2021-08-26 2021-11-26 深圳小佳科技有限公司 Hotspot network distribution method and device, intelligent terminal and storage medium

Citations (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1601140A2 (en) * 2004-05-29 2005-11-30 Sarian Systems Ltd. Method of monitoring a member router in a VRRP group
CN101247297A (en) * 2007-02-16 2008-08-20 华为技术有限公司 Device, system and method for automatically configuring application terminal in family network
CN101480078A (en) * 2006-05-16 2009-07-08 奥图网移动公司 Mobile router that monitors links
CN102348198A (en) * 2011-10-27 2012-02-08 中兴通讯股份有限公司 Wireless terminal and remote parameter setting method thereof
CN102523276A (en) * 2011-12-09 2012-06-27 华为终端有限公司 Method, equipment and system for managing mobile broadband equipment
CN102904970A (en) * 2012-11-21 2013-01-30 成都市迅电网络技术有限公司 Method and system for automatically controlling router
CN103442045A (en) * 2013-08-19 2013-12-11 深圳市华讯方舟科技有限公司 Method for enabling intelligent device to get access to wireless router
CN103970566A (en) * 2014-04-25 2014-08-06 北京奇虎科技有限公司 Router firmware updating method and device
CN104243210A (en) * 2014-09-17 2014-12-24 湖北盛天网络技术股份有限公司 Method and system for remotely having access to administrative web pages of routers
CN104301139A (en) * 2014-09-28 2015-01-21 北京奇虎科技有限公司 Router adaptation method and device and terminal device
CN104468291A (en) * 2014-11-18 2015-03-25 深圳市金博通科技有限公司 WiFi module communication method and device
CN104821891A (en) * 2009-11-23 2015-08-05 皇家Kpn公司 Method and system for remote equipment management
CN204669390U (en) * 2015-02-10 2015-09-23 联想(北京)有限公司 A kind of electronic equipment
CN105025506A (en) * 2015-08-07 2015-11-04 上海斐讯数据通信技术有限公司 AP equipment remote management method by means of cloud AC
CN105187262A (en) * 2015-10-27 2015-12-23 上海斐讯数据通信技术有限公司 Router upgrading method and system
CN105245359A (en) * 2015-09-07 2016-01-13 上海斐讯数据通信技术有限公司 Remote router management method, system and device
CN105306581A (en) * 2015-11-11 2016-02-03 上海斐讯数据通信技术有限公司 Router and cloud disk based data synchronization method
CN105338603A (en) * 2015-10-23 2016-02-17 醴陵恒茂电子科技有限公司 Method for adjusting transmission power of wireless router in self-adaptive manner, and wireless router
CN105553684A (en) * 2015-09-24 2016-05-04 上海斐讯数据通信技术有限公司 Communication system and applied router upgrading method thereof
CN106100911A (en) * 2016-08-23 2016-11-09 上海斐讯数据通信技术有限公司 Cloud collocation method, router, Cloud Server and the system of a kind of router
CN107291520A (en) * 2017-08-14 2017-10-24 深圳市兆驰数码科技股份有限公司 A kind of software automatic updating method
CN109951308A (en) * 2017-12-21 2019-06-28 深圳Tcl新技术有限公司 A kind of method for configuring routers, device and storage medium
CN109996314A (en) * 2017-12-29 2019-07-09 阿里巴巴集团控股有限公司 A kind of methods, devices and systems to distribution net equipment access network hotspot equipment

Patent Citations (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1601140A2 (en) * 2004-05-29 2005-11-30 Sarian Systems Ltd. Method of monitoring a member router in a VRRP group
CN101480078A (en) * 2006-05-16 2009-07-08 奥图网移动公司 Mobile router that monitors links
CN101247297A (en) * 2007-02-16 2008-08-20 华为技术有限公司 Device, system and method for automatically configuring application terminal in family network
CN104821891A (en) * 2009-11-23 2015-08-05 皇家Kpn公司 Method and system for remote equipment management
CN102348198A (en) * 2011-10-27 2012-02-08 中兴通讯股份有限公司 Wireless terminal and remote parameter setting method thereof
CN102523276A (en) * 2011-12-09 2012-06-27 华为终端有限公司 Method, equipment and system for managing mobile broadband equipment
CN102904970A (en) * 2012-11-21 2013-01-30 成都市迅电网络技术有限公司 Method and system for automatically controlling router
CN103442045A (en) * 2013-08-19 2013-12-11 深圳市华讯方舟科技有限公司 Method for enabling intelligent device to get access to wireless router
CN103970566A (en) * 2014-04-25 2014-08-06 北京奇虎科技有限公司 Router firmware updating method and device
CN104243210A (en) * 2014-09-17 2014-12-24 湖北盛天网络技术股份有限公司 Method and system for remotely having access to administrative web pages of routers
CN104301139A (en) * 2014-09-28 2015-01-21 北京奇虎科技有限公司 Router adaptation method and device and terminal device
CN104468291A (en) * 2014-11-18 2015-03-25 深圳市金博通科技有限公司 WiFi module communication method and device
CN204669390U (en) * 2015-02-10 2015-09-23 联想(北京)有限公司 A kind of electronic equipment
CN105025506A (en) * 2015-08-07 2015-11-04 上海斐讯数据通信技术有限公司 AP equipment remote management method by means of cloud AC
CN105245359A (en) * 2015-09-07 2016-01-13 上海斐讯数据通信技术有限公司 Remote router management method, system and device
CN105553684A (en) * 2015-09-24 2016-05-04 上海斐讯数据通信技术有限公司 Communication system and applied router upgrading method thereof
CN105338603A (en) * 2015-10-23 2016-02-17 醴陵恒茂电子科技有限公司 Method for adjusting transmission power of wireless router in self-adaptive manner, and wireless router
CN105187262A (en) * 2015-10-27 2015-12-23 上海斐讯数据通信技术有限公司 Router upgrading method and system
CN105306581A (en) * 2015-11-11 2016-02-03 上海斐讯数据通信技术有限公司 Router and cloud disk based data synchronization method
CN106100911A (en) * 2016-08-23 2016-11-09 上海斐讯数据通信技术有限公司 Cloud collocation method, router, Cloud Server and the system of a kind of router
CN107291520A (en) * 2017-08-14 2017-10-24 深圳市兆驰数码科技股份有限公司 A kind of software automatic updating method
CN109951308A (en) * 2017-12-21 2019-06-28 深圳Tcl新技术有限公司 A kind of method for configuring routers, device and storage medium
CN109996314A (en) * 2017-12-29 2019-07-09 阿里巴巴集团控股有限公司 A kind of methods, devices and systems to distribution net equipment access network hotspot equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
潘春建等: "IPv4/IPv6双协议栈路由器远程管理的设计与实现", 《计算机工程》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113709142A (en) * 2021-08-26 2021-11-26 深圳小佳科技有限公司 Hotspot network distribution method and device, intelligent terminal and storage medium
CN113709142B (en) * 2021-08-26 2023-06-23 深圳小佳科技有限公司 Hot spot distribution network method and device, intelligent terminal and storage medium
CN113691858A (en) * 2021-08-31 2021-11-23 Vidaa美国公司 Display device and interface display method

Also Published As

Publication number Publication date
CN111884938B (en) 2022-12-30

Similar Documents

Publication Publication Date Title
US20190289467A1 (en) Bootstrap mechanism for endpoint devices
EP1954086B1 (en) (U)SIM card in server mode, and communication method with client
CN111885115B (en) Device binding changing method and device
CN109981668A (en) Common apparatus Internet of Things communication means based on the extensive agreement of MQTT
US20070276935A1 (en) Method for Processing Asynchronous Communication Mechanism Based on Simple Network Management Protocol
CN113411215B (en) Time-sensitive network centralized user configuration method and system based on OPC UA
CN112671904B (en) Method and device for transmitting equipment state information, storage medium and electronic device
CN110808948B (en) Remote procedure calling method, device and system
CN107623752B (en) Network management method and device based on link layer
CN111884938B (en) Router information acquisition method and device
CN112423322B (en) Model information sending method, device, storage medium and electronic device
CN112637931A (en) Method and device for establishing network connection
CN113965904A (en) Device registration method, device and storage medium
CN113613251A (en) Information synchronization method and system, storage medium and electronic device
CN116319953B (en) Semiconductor device data acquisition method
WO2010124571A1 (en) Node information acquirement method, client, and server
CN111865790B (en) Method and device for collecting router information, internet of things equipment and Internet of things system
WO2022041827A1 (en) Transmission method and apparatus for mobile network detection information, and storage medium
CN111642031B (en) Method for connecting multiple devices, electronic device and computer readable storage medium
CN111343261A (en) Mobile phone data backup method based on wireless hotspot transmission
CN107784006B (en) Data processing method and device
KR100844361B1 (en) Gateway system for data synchronization
WO2019074032A1 (en) Apparatus, method and program for transmitting and receiving data to and from iot device
CN115086446B (en) Data transmission method, system, device, equipment and computer readable storage medium
WO2023044675A1 (en) Method for obtaining edge data, connector, and data platform

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