[go: up one dir, main page]

CN107613002B - Method and device for inquiring equipment information and equipment used by same - Google Patents

Method and device for inquiring equipment information and equipment used by same Download PDF

Info

Publication number
CN107613002B
CN107613002B CN201710850937.1A CN201710850937A CN107613002B CN 107613002 B CN107613002 B CN 107613002B CN 201710850937 A CN201710850937 A CN 201710850937A CN 107613002 B CN107613002 B CN 107613002B
Authority
CN
China
Prior art keywords
equipment
information
network segment
target network
querying
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710850937.1A
Other languages
Chinese (zh)
Other versions
CN107613002A (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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201710850937.1A priority Critical patent/CN107613002B/en
Publication of CN107613002A publication Critical patent/CN107613002A/en
Application granted granted Critical
Publication of CN107613002B publication Critical patent/CN107613002B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

本发明公开了一种查询设备信息的方法包括:在目标网段范围内创建预设数量的线程;查询所述目标网段范围内的每个设备所属设备类型对应的命令组,并通过所述线程向所述每个设备发送所述命令组中的查询命令;判断是否存在返回信息,若是,则记录所述返回信息。由此可见,本发明公开的查询设备信息的方法,采用多线程并发获取目标网段范围内目标设备的设备信息,实现了通过较低的成本以较高的效率查询设备信息。本发明还公开了一种查询设备信息的装置及其使用的查询设备信息的设备和计算机可读存储介质,同样能实现上述技术效果。

Figure 201710850937

The invention discloses a method for querying device information, comprising: creating a preset number of threads within a target network segment; querying a command group corresponding to a device type to which each device within the target network segment belongs, and The thread sends the query command in the command group to each device; judges whether there is return information, and if so, records the return information. It can be seen that the method for querying device information disclosed in the present invention adopts multiple threads to concurrently acquire the device information of the target device within the target network segment, and realizes the query of device information with relatively low cost and high efficiency. The invention also discloses a device for querying device information, a device for querying device information and a computer-readable storage medium used therefor, which can also achieve the above technical effects.

Figure 201710850937

Description

Method and device for inquiring equipment information and equipment used by same
Technical Field
The present invention relates to the field of computer communication, and more particularly, to a method and an apparatus for querying device information, and a device and a computer-readable storage medium for querying device information used in the method and apparatus.
Background
In the daily operation and maintenance process, devices are usually deployed in the same network segment, so as to facilitate uniform maintenance and management. During maintenance, the status of devices within a network segment needs to be constantly checked. One method for viewing the device status in the prior art is to use a server to manage the devices and query the device status through a network management page, and the method has the disadvantages of high hardware and software cost; another method is to manually ping the IP address of the device to obtain the status of the device, which has the disadvantage of low obtaining efficiency.
Therefore, how to query the device information with high efficiency through low cost is a problem to be solved by those skilled in the art.
Disclosure of Invention
The invention aims to provide a method and a device for inquiring equipment information, equipment for inquiring the equipment information and a computer readable storage medium, which are used for realizing the purpose of inquiring the equipment information with higher efficiency through lower cost.
In order to achieve the above object, an embodiment of the present invention provides a method for querying device information, including:
creating a preset number of threads in the range of the target network segment;
inquiring a command group corresponding to the type of the equipment to which each equipment in the target network segment belongs, and sending an inquiry command in the command group to each equipment through the thread;
and judging whether return information exists or not, and if so, recording the return information.
After a preset number of threads are created in the range of the target network segment, the method further comprises the following steps:
sending a connection request to each device through the thread according to the IP address and the port number of each device in the target network segment range so that each device can return a request result;
and judging whether connected equipment which is successfully connected exists in the range of the target network segment according to the request result, and inquiring a command group corresponding to the equipment type of the connected equipment if the connected equipment exists in the range of the target network segment.
If the connection of the target device in the target network segment range fails, the method further comprises the following steps:
judging whether the connection times of the target equipment reach preset connection times or not;
and if not, sending the connection request to the target equipment through the thread again.
Before querying the command group corresponding to the device type of each device in the target network segment range, the method further includes:
inquiring a user name password group corresponding to the type of the connected equipment, and logging in the connected equipment by using the user name password in the user name password group through the thread;
and judging whether the connected equipment has logged-in equipment which logs in successfully, if so, inquiring a command group corresponding to the equipment type of the logged-in equipment.
Before querying the username password group corresponding to the device type to which the connected device belongs, the method further includes:
and determining the equipment type of the connected equipment according to the request result.
In order to achieve the above object, an embodiment of the present invention provides an apparatus for querying device information, including:
the creating module is used for creating threads with preset number in the range of the target network segment;
the query module is used for querying a command group corresponding to the type of the equipment to which each equipment in the target network segment belongs and sending query commands in the command group to each equipment through the thread;
and the recording module is used for judging whether return information exists or not, and recording the return information if the return information exists.
Wherein, still include:
the connection module is used for sending a connection request to each device through the thread according to the IP address and the port number of each device in the target network segment range so that each device can return a request result;
and the first judgment module is used for judging whether connected equipment which is successfully connected exists in the target network segment range according to the request result, and if so, the inquiry module is triggered.
Wherein, still include:
the login module is used for inquiring a user name password group corresponding to the type of the connected equipment and logging in the connected equipment by using the user name password in the user name password group through the thread;
and the second judgment module is used for judging whether the connected equipment has logged-in equipment which logs in successfully or not, and if so, triggering the query module.
In order to achieve the above object, an embodiment of the present invention provides an apparatus for querying device information, including:
the memorizer, is used for storing the information inquiry procedure;
and the processor is used for realizing the steps of any one of the equipment information inquiring methods when the information inquiring program is executed.
To achieve the above object, an embodiment of the present invention provides a computer-readable storage medium, on which an information query program is stored, and the information query program, when executed by a processor, implements the method for querying device information as described in any one of the above.
According to the scheme, the method for inquiring the equipment information, provided by the embodiment of the invention, comprises the following steps: creating a preset number of threads in the range of the target network segment; inquiring a command group corresponding to the type of the equipment to which each equipment in the target network segment belongs, and sending an inquiry command in the command group to each equipment through the thread; and judging whether return information exists or not, and if so, recording the return information. Therefore, the method for inquiring the equipment information provided by the embodiment of the invention adopts multithreading to concurrently acquire the equipment information of the target equipment in the target network segment range, and realizes that the equipment information is inquired at higher efficiency through lower cost. The invention also discloses a device for inquiring the equipment information, equipment for inquiring the equipment information and a computer readable storage medium, which can also realize the technical effects.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for querying device information according to an embodiment of the present invention;
FIG. 2 is a flowchart of another method for querying device information according to an embodiment of the present invention;
fig. 3 is a structural diagram of an apparatus for querying device information according to an embodiment of the present invention;
fig. 4 is a structural diagram of a device for querying device information according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a method for inquiring equipment information, which realizes the inquiry of the equipment information with higher efficiency through lower cost.
Referring to fig. 1, a flowchart of a method for querying device information according to an embodiment of the present invention is shown in fig. 1, and includes:
s101: creating a preset number of threads in the range of the target network segment;
in a specific implementation, for a given target network segment range, a preset number of threads are created according to a given number of concurrent connections, for example, 10 concurrent Socket threads may be created within the target network segment range 172.16.1.0 to 172.16.1.255.
Socket, also called Socket, is one of the basic technologies for computer network communication. Most of the network-based software such as browser, instant messenger and even P2P download today are based on Socket. Socket is an intermediate software abstraction layer for the application layer to communicate with the TCP/IP suite of protocols, which is a set of interfaces. In a design mode, Socket is actually a facade mode, a complex TCP/IP protocol family is hidden behind a Socket interface, for a user, a group of simple interfaces are all, and the Socket organizes data to accord with a specified protocol.
S102: inquiring a command group corresponding to the type of the equipment to which each equipment in the target network segment belongs, and sending an inquiry command in the command group to each equipment through the thread;
s103: and judging whether return information exists or not, if so, recording the return information, and if not, ending the process.
In a specific implementation, through the created concurrent Socket thread, a command is sequentially sent to each device from a command group, which may use the query device information, of the device type to which each device in the target network segment belongs until the device information is returned. If some equipment has the return information, the inquiry is successful, the return information corresponding to the equipment is recorded, and the equipment state is set as the inquiry success. If all the commands of a certain device fail to be tried, the state of the device is set as query failure.
In the above example, 10 concurrent Socket threads query the device information of 10 devices at the same time, and when there is a returned result or a device corresponding to a certain thread is determined to be failed in querying, the thread continues to query the device information of the target network segment except the 10 devices until all the devices in the target network segment are queried.
The method for inquiring the equipment information provided by the embodiment of the invention adopts multithreading to concurrently acquire the equipment information of the target equipment in the range of the target network segment, thereby realizing the inquiry of the equipment information with higher efficiency through lower cost.
The embodiment of the invention discloses a method for inquiring equipment information, and compared with the previous embodiment, the embodiment further explains and optimizes the technical scheme. Specifically, the method comprises the following steps:
referring to fig. 2, a flowchart of another method for querying device information according to an embodiment of the present invention is shown in fig. 2, and includes:
s201: creating a preset number of threads in the range of the target network segment;
s221: sending a connection request to the target equipment through the thread according to the IP address and the port number of the target equipment within the range of the target network segment so that the target equipment can return a request result;
s222: judging whether connected equipment which is successfully connected exists in the target network segment range according to the request result, if so, entering S231, and if not, setting the state of the equipment in the target network segment range as connection failure;
in a specific implementation, before sending a command in a command group to each device in a target network segment, the devices need to be connected through Socket threads. Connecting a plurality of devices through multithread Socket in an asynchronous communication mode according to the IP address and the port number of the target device, processing according to a request result returned by the target device in a thread, if the connection is successful, the target device is a connected device, and S231 is entered, and if the connection is failed, the state of the target device is set as connection failure.
S231: determining the equipment type of the connected equipment according to the request result;
in a specific implementation, the device may directly notify the processor of the type of the device through the request result, so that the processor determines the device type of the connected device through the request result, and of course, the processor may also determine the device type of the connected device through other manners, which is not limited herein.
S232: inquiring a user name password group corresponding to the type of the connected equipment, and logging in the connected equipment by using the user name password in the user name password group through the thread;
s233: judging whether the connected equipment has logged-in equipment which logs in successfully or not, if so, entering S204, and if not, setting the state of the connected equipment as login failure;
after the connected equipment is successfully connected, sequentially trying each group of user name and password from the user name and password group possibly used by the equipment type to which each connected equipment belongs until login is successful, and if all the user name and password groups are failed to login, setting the state of the connected equipment as login failure.
It is to be understood that the thread used for logging in the connected device may be a thread connected to the device, or another thread may be reassigned to the device for logging in, and is not limited in particular herein.
S204: inquiring a command group corresponding to the type of the equipment to which the logged equipment belongs, and sending an inquiry command in the command group to the logged equipment through the thread;
s205: and judging whether the logged-in equipment has equipment with return information or not, if so, recording the return information corresponding to the equipment with the return information, and if not, setting the state of the logged-in equipment as query failure.
On the basis of the foregoing embodiment, as a preferred implementation, if the target device within the target network segment fails to connect, the method further includes:
judging whether the connection times of the target equipment reach preset connection times or not;
and if not, sending the connection request to the target equipment through the thread again.
If the target device in the target network segment fails to be connected, the previous thread is continuously used for connecting the target device until the preset connection times are reached, and if the target device still fails to be connected, the state of the target device is set as the connection failure.
The apparatus for querying device information according to the embodiments of the present invention is introduced below, and the apparatus for querying device information described below and the method for querying device information described above may refer to each other.
Referring to fig. 3, a structure diagram of an apparatus for querying device information according to an embodiment of the present invention is shown in fig. 3, and includes:
a creating module 301, configured to create a preset number of threads in a target network segment range;
a query module 302, configured to query a command group corresponding to a device type to which each device in the target network segment belongs, and send a query command in the command group to each device through the thread;
the recording module 303 is configured to determine whether there is return information, and record the return information if there is the return information.
The device for inquiring the equipment information provided by the embodiment of the invention adopts multithreading to concurrently acquire the equipment information of the target equipment in the target network segment range, thereby realizing the inquiry of the equipment information with higher efficiency through lower cost.
In addition to the above embodiments, as a preferred embodiment, the method further includes:
the connection module is used for sending a connection request to each device through the thread according to the IP address and the port number of each device in the target network segment range so that each device can return a request result;
and the first judgment module is used for judging whether connected equipment which is successfully connected exists in the target network segment range according to the request result, and if so, the inquiry module is triggered.
In addition to the above embodiments, as a preferred embodiment, the method further includes:
the login module is used for inquiring a user name password group corresponding to the type of the connected equipment and logging in the connected equipment by using the user name password in the user name password group through the thread;
and the second judgment module is used for judging whether the connected equipment has logged-in equipment which logs in successfully or not, and if so, triggering the query module.
The present application further provides a device for querying device information, referring to fig. 4, a structure diagram of a device for querying device information provided in an embodiment of the present invention is shown in fig. 4, and includes:
a memory 401 for storing an information inquiry program;
the processor 402, when executing the information query program, may implement the steps provided in the above embodiments. Of course, the server may also include various network interfaces, power supplies, and the like.
The device for inquiring the device information provided by the embodiment of the invention adopts multithreading to concurrently acquire the device information of the target device in the range of the target network segment, thereby realizing the purpose of inquiring the device information with higher efficiency through lower cost.
The present application further provides a computer-readable storage medium, on which an information query program is stored, and when the information query program is executed by a processor, the steps provided by the above embodiments can be implemented. The storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (7)

1. A method for querying device information, comprising:
creating a preset number of threads in the range of the target network segment;
inquiring a command group corresponding to the type of the equipment to which each equipment in the target network segment belongs, and sending an inquiry command in the command group to each equipment through the thread;
judging whether returned equipment information exists, and if yes, recording the equipment information;
after a preset number of threads are created in the range of the target network segment, the method further comprises the following steps:
sending a connection request to each device through the thread according to the IP address and the port number of each device in the target network segment range so that each device can return a request result;
judging whether connected equipment which is successfully connected exists in the range of the target network segment or not according to the request result;
if so, determining the device type of the connected device according to the request result, inquiring a command group corresponding to the device type of the connected device, and sending an inquiry command in the command group to each connected device through the thread.
2. The method of claim 1, wherein if the connection of the target device within the range of the target network segment fails, further comprising:
judging whether the connection times of the target equipment reach preset connection times or not;
and if not, sending the connection request to the target equipment through the thread again.
3. The method according to claim 2, wherein before querying the command group corresponding to the device type of each device in the range of the target network segment, the method further comprises:
inquiring a user name password group corresponding to the type of the connected equipment, and logging in the connected equipment by using the user name password in the user name password group through the thread;
and judging whether the connected equipment has logged-in equipment which logs in successfully, if so, inquiring a command group corresponding to the equipment type of the logged-in equipment.
4. An apparatus for querying device information, comprising:
the creating module is used for creating threads with preset number in the range of the target network segment;
the query module is used for querying a command group corresponding to the type of the equipment to which each equipment in the target network segment belongs and sending query commands in the command group to each equipment through the thread;
the recording module is used for judging whether returned equipment information exists or not, and recording the equipment information if the returned equipment information exists;
wherein, still include:
the connection module is used for sending a connection request to each device through the thread according to the IP address and the port number of each device in the target network segment range so that each device can return a request result;
and the first judgment module is used for judging whether connected equipment which is successfully connected exists in the range of the target network segment according to the request result, if so, determining the equipment type of the connected equipment according to the request result, inquiring a command group corresponding to the equipment type of the connected equipment, and sending an inquiry command in the command group to each connected equipment through the thread.
5. The apparatus for querying device information according to claim 4, further comprising:
the login module is used for inquiring a user name password group corresponding to the type of the connected equipment and logging in the connected equipment by using the user name password in the user name password group through the thread;
and the second judgment module is used for judging whether the connected equipment has logged-in equipment which logs in successfully or not, and if so, triggering the query module.
6. An apparatus for querying device information, comprising:
the memorizer, is used for storing the information inquiry procedure;
a processor for implementing the steps of the method for querying device information according to any one of claims 1 to 3 when executing the information query program.
7. A computer-readable storage medium, wherein the computer-readable storage medium stores thereon an information query program, and the information query program, when executed by a processor, implements the method for querying device information according to any one of claims 1 to 3.
CN201710850937.1A 2017-09-20 2017-09-20 Method and device for inquiring equipment information and equipment used by same Active CN107613002B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710850937.1A CN107613002B (en) 2017-09-20 2017-09-20 Method and device for inquiring equipment information and equipment used by same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710850937.1A CN107613002B (en) 2017-09-20 2017-09-20 Method and device for inquiring equipment information and equipment used by same

Publications (2)

Publication Number Publication Date
CN107613002A CN107613002A (en) 2018-01-19
CN107613002B true CN107613002B (en) 2021-04-06

Family

ID=61061186

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710850937.1A Active CN107613002B (en) 2017-09-20 2017-09-20 Method and device for inquiring equipment information and equipment used by same

Country Status (1)

Country Link
CN (1) CN107613002B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112543215B (en) * 2019-09-23 2024-06-21 北京国双科技有限公司 Access request processing method, system, device, storage medium and electronic equipment
CN112733001B (en) * 2021-01-14 2023-09-29 上海蓝云网络科技有限公司 Method and device for acquiring subscription information and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103248539A (en) * 2013-05-17 2013-08-14 上海大亚科技有限公司 Network equipment integrated test control system and method
CN104735143A (en) * 2015-03-18 2015-06-24 湖南天冠电子信息技术有限公司 Batch control system and method based on smart home cloud platform

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8079035B2 (en) * 2005-12-27 2011-12-13 Intel Corporation Data structure and management techniques for local user-level thread data
CN101424941B (en) * 2007-10-31 2011-05-25 北京北方微电子基地设备工艺研究中心有限责任公司 Control implementing method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103248539A (en) * 2013-05-17 2013-08-14 上海大亚科技有限公司 Network equipment integrated test control system and method
CN104735143A (en) * 2015-03-18 2015-06-24 湖南天冠电子信息技术有限公司 Batch control system and method based on smart home cloud platform

Also Published As

Publication number Publication date
CN107613002A (en) 2018-01-19

Similar Documents

Publication Publication Date Title
US11399014B2 (en) System and method of obtaining data from private cloud behind enterprise firewall
US20080209196A1 (en) Method to Enable Firmware to Boot a System from an ISCSI Device
WO2017084348A1 (en) Management method and apparatus for ip hard disk
KR20140117449A (en) Implicit ssl certificate management without server name indication (sni)
CN109274777B (en) A method, device, equipment and readable storage medium for exporting configuration files
WO2021238990A1 (en) Authentication method and apparatus, electronic device, server, program, and storage medium
US10798017B2 (en) Method and system for reclaiming unused resources in a networked application environment
KR20190130933A (en) Method and apparatus for constructing data based blockchain
CN105072608B (en) A method and apparatus for managing authentication tokens
CN107566433A (en) A kind of cloud terminal logs in virtual desktop method and device
CN107613002B (en) Method and device for inquiring equipment information and equipment used by same
WO2018024176A1 (en) Device and method preventing repeated logins of same user
CN104811473A (en) Virtual nonvolatile storage medium establishing method and system and management system
CN107172061A (en) It is a kind of to realize shared method and system
CN105471616B (en) Caching system management method and system
CN108289074A (en) User account login method and device
US20160099928A1 (en) Systems and methods for managing connections for universal plug-and-play devices
TWI582584B (en) Method and apparatus for identifying network traffic characteristics to associate and manage one or more subsequent processes
CN113812125B (en) Verification method and device for login behavior, system, storage medium and electronic device
CN107566182A (en) The adapting method and system of a kind of NFS
US11558454B2 (en) Group leader role queries
US10212036B2 (en) Performance testing method, performance testing apparatus performing the same and storage medium storing the same
TW201719455A (en) Interpreting data server, network device and automatic resource management method
CN107395416A (en) A kind of data transmission method for uplink and server cluster
CN110297598B (en) A data synchronization method and storage system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant