CN106850345B - Method for monitoring and inquiring network user state - Google Patents
Method for monitoring and inquiring network user state Download PDFInfo
- Publication number
- CN106850345B CN106850345B CN201710051827.9A CN201710051827A CN106850345B CN 106850345 B CN106850345 B CN 106850345B CN 201710051827 A CN201710051827 A CN 201710051827A CN 106850345 B CN106850345 B CN 106850345B
- Authority
- CN
- China
- Prior art keywords
- user
- state
- uid
- status
- states
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention discloses a method for monitoring network user states, firstly defining a two-dimensional marking array status [ ] in a server memory, initializing a unit value to be 0, allocating a unique user number uid to each user, defining n attribute states of an access attribute sid, and setting whether the user is in an online state as a user main state; when a user logs in, setting a unit value corresponding to the main state as 1, and setting marking array unit values corresponding to the rest n-1 attribute states according to the actual situation of the user; and when the user logs out, all the corresponding marked array unit values are restored to 0. The invention also discloses a query method of the network user state, firstly querying the uid of the user in the database table, and then calling the corresponding marking array status [ uid ] [ sid ]; and judging all attribute states of the user according to the unit values of the n marked arrays. The method can improve the speed of inquiring the user state and reduce the occupied space of the memory of the server.
Description
Technical Field
The invention belongs to the technical field of internet communication, and particularly relates to a user state monitoring and inquiring method for realizing network management.
Background
At present, with the rapid development of network technology, more and more offices depend on the Internet, and for the convenience of carrying files, various network document management systems are developed, so that people are no longer limited to only storing files in respective terminal computers. In order to improve the working efficiency and information security of employees of enterprises (units), most of the enterprises (units) perform certain control on office files of the employees, and the employees of the enterprises are inevitably required to be corresponded to an account of a network management system.
Most document management systems commonly used by us are composed of a client, a server and a console, and communication between the client, the server and the console is often carried out pairwise. Usually, the client wants to access the server and logs in to the server by using a special username and password, and meanwhile, an administrator manages the operation and use of the account by the employee and knows the login condition and state of some current clients through a console.
Currently, the monitoring of user states is to set state attributes for server user objects, mark different login states of users through the values of the state attributes, simultaneously create Map set classes, write information into the Map through login with key values (network token: character string) and value as user name, and judge whether the user logs in through traversing the Map.
This monitoring method has the following drawbacks:
(1) the method needs to rely on real-time maintenance and database searching to change the user state.
(2) The method is not fast enough, when the server needs to judge whether the current user logs in, because the key value is token, the value is the only mark generated after the login is successful, the value may have the same user name, the value cannot be quickly searched through the key when searching whether a certain user logs in, and the judgment can be carried out only by completely traversing the value of the Map set.
Similar to some common chat software, the status of a user typically includes substantially online, offline, busy, and the like. In order to mark or change a certain state of a user or a client in real time, information transmitted to the client by a server is important. Because the available memory resources of the server in the operation process are limited and the information loss problem possibly exists in the network communication process, the excessive occupation of the system memory by the server should be avoided as much as possible. For the development of the computer technology, which is changing day by day, sometimes the network environment of the client is variable, and the access server mode is various, at this time, in order to identify different intentions of the client, the server needs to define many communication interfaces, and information transmitted by the client when calling the interfaces should be as simplified as possible.
Secondly, whether the current user or client needs to be online or not is judged with higher efficiency, and the traditional method for judging through traversal is obviously not efficient under the condition of extremely large number of users. At this time, the server needs to accurately judge the current state type of a certain user, so that the method is more efficient, and the uniqueness of account login is controlled to a certain extent.
To meet these requirements, a general solution is needed to optimize the use of the server memory as much as possible, and to flexibly configure the server memory without depending on the target network environment.
Disclosure of Invention
The invention aims to provide a method for monitoring and querying a network user state, which can improve the speed of querying the user state and reduce the occupied space of a server memory.
In order to achieve the above purpose, the solution of the invention is:
a method for monitoring network user state includes the following steps:
step a1, defining a two-dimensional marking array status [ ] [ ] with length L in a server memory, wherein L is set to be larger than the expected number of network users, and initializing the unit value of the marking array status [ ] [ ] to 0, unit bit;
a2, allocating a unique integer-type user number uid to each user in a database table, defining n attribute states of an integer-type access attribute sid, setting the ith attribute state as whether the user is online, wherein the state is the main state of the user, the rest n-1 attribute states are the secondary states, and i is more than or equal to 0 and less than or equal to n-1;
step a3, when the user logs in, setting status [ uid ] [ i ] to 1, and setting unit values of the marking array status [ uid ] [ sid ] corresponding to the rest n-1 attribute states according to the actual situation of the user;
in step a4, when the user logs out, all cell values of the corresponding status [ uid ] [0] to status [ uid ] [ n-1] are restored to 0.
In the above step a2, when the user number uid is assigned to the user, the number is incremented from 1.
In the step a3, when the user changes a sub-state in the user login state, the cell values corresponding to the other states except the changed sub-state in all the sub-states are first restored to 0, and then set according to the actual situation.
A method for inquiring the state of a network user comprises the following steps:
step b1, querying the uid of the user in the database table, and calling the corresponding marking array status [ uid ] [ sid ];
and step b2, judging all attribute states of the user according to the cell values of the status [ uid ] [0] to the status [ uid ] [ n-1 ].
In step b2, it is first determined whether the flag array status [ uid ] [ i ] corresponding to the user uid is 1, and only when status [ uid ] [ i ] becomes 1, it is determined whether the cell values of the flag array status [ uid ] [ sid ] corresponding to other attribute states are equal to each other, so that all the attribute states of the user are known.
After adopting the scheme, the invention has the following characteristics:
(1) on a system platform, a server associates and manages other attribute states of a user according to an existing user mark, and binary representation information is easy to understand and identify a machine;
(2) the method has accuracy, can quickly search the state of a certain user, and simultaneously ensures the uniqueness of user login;
(3) the invention has the advantages of simplicity, which is shown in that: the array operation is convenient and easy to understand, and because the array is a bit array, the space memory is not occupied theoretically;
(4) the invention has high compatibility, can be suitable for different programming language platforms, and the binary data is easy to store and transfer.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
The technical solution and the advantages of the present invention will be described in detail with reference to the accompanying drawings.
As shown in fig. 1, the present invention provides a method for monitoring a network user status, which comprises the following steps:
a1, defining bit two-dimensional label array status [ ] with length L in the server memory, wherein L is set to be larger than the expected network user number to satisfy the requirement when all users log in the server; initializing the unit value of the marking array status to 0 (unit bit), and adopting the minimum unit bit of the computer to reduce the occupation of the memory to the maximum extent;
a2, allocating a unique integer user number uid to each user in a database table, sequentially increasing from 1 in actual operation, and defining an integer access attribute sid, which has n attribute states from 0 to n-1, for example, sid is 0 corresponding to whether online (main state), sid is 1 corresponding to whether abnormal (secondary state), sid is 2 corresponding to whether busy (secondary state), etc.;
a3, when the server knows that a user has logged in, setting a corresponding access attribute sid in a database table according to the user number uid, setting sid to 0, and setting the corresponding unit value of the marking array status [ ] [ ] to 1 to mark that the user has logged in;
step a4, when the flag array status [ uid ] [0] is equal to 1 and the user is online, it will be continuously determined whether the cell value of the flag array status [ uid ] [ sid ] of the other attribute state is 1, if so, it indicates that the user is in the corresponding attribute state, and if so, it indicates that the user is not in the attribute state; for example, under the definition conditions of step a2, if status [ uid ] [1] ═ 1, it indicates that the user is abnormal, and if status [ uid ] [1] = 0, it indicates that the user is normal; in the concrete implementation, when a certain user state is changed, a change notice is actively sent to the server, and meanwhile, the server regularly scans the user state, so that the correctness of the user state is ensured;
in the user login state, when the user changes a certain sub-state, the states except the changed sub-state in the states [ uid ] [1] to [ uid ] [ n-1] are restored to 0, and then the required state is set to 1 correspondingly, thereby improving the efficiency.
Step a5, when the user logs out, the corresponding status [ uid ] [0] to status [ uid ] [ n-1] values are all reduced to 0.
The invention also provides a method for inquiring the state of the network user, which comprises the following steps:
step b1, querying the uid of the user in the database table, and calling the corresponding marking array status [ uid ] [ sid ];
step b2, judging whether the unit value of status [ uid ] [0] is 1, if so, indicating that the user is in a login state, turning to step b3, otherwise, the user is not online, and finishing the query;
step b3, further judge the unit value of status [ uid ] [1] to status [ uid ] [ n-1], learn all the attribute status of the user.
The above embodiments are only for illustrating the technical idea of the present invention, and the protection scope of the present invention is not limited thereby, and any modifications made on the basis of the technical scheme according to the technical idea of the present invention fall within the protection scope of the present invention.
Claims (2)
1. A method for monitoring network user state is characterized by comprising the following steps:
step a1, defining a two-dimensional marking array status [ ] [ ] with length L in a server memory, wherein L is set to be larger than the expected number of network users, and initializing the unit value of the marking array status [ ] [ ] to 0, unit bit; a2, allocating a unique integer-type user number uid to each user in a database table, defining n attribute states of an integer-type access attribute sid, setting the ith attribute state as whether the user is online, wherein the state is the main state of the user, the rest n-1 attribute states are the secondary states, and i is more than or equal to 0 and less than or equal to n-1;
step a3, when the user logs in, setting status [ uid ] [ i ] to 1, and setting unit values of the marking array status [ uid ] [ sid ] corresponding to the rest n-1 attribute states according to the actual situation of the user; step a4, when the user logs out, reducing all the corresponding unit values of status [ uid ] [0] to status [ uid ] [ n-1] to 0;
in the step a3, when the user changes a certain sub-state in the user login state, the cell values corresponding to the other states except the changed sub-state in all the sub-states are first restored to 0, and then are set according to the actual situation.
2. A method for monitoring the status of a network subscriber as claimed in claim 1, characterized by: in step a2, when the user number uid is assigned to the user, the user number uid is incremented from 1.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710051827.9A CN106850345B (en) | 2017-01-21 | 2017-01-21 | Method for monitoring and inquiring network user state |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710051827.9A CN106850345B (en) | 2017-01-21 | 2017-01-21 | Method for monitoring and inquiring network user state |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106850345A CN106850345A (en) | 2017-06-13 |
CN106850345B true CN106850345B (en) | 2020-11-06 |
Family
ID=59120348
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710051827.9A Active CN106850345B (en) | 2017-01-21 | 2017-01-21 | Method for monitoring and inquiring network user state |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106850345B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111026926A (en) * | 2019-12-17 | 2020-04-17 | 腾讯音乐娱乐科技(深圳)有限公司 | Data processing method, device, equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1540544A (en) * | 2003-04-22 | 2004-10-27 | 联想(北京)有限公司 | Method for tracking and controlling users' online states and information |
CN101296200A (en) * | 2008-06-30 | 2008-10-29 | 腾讯科技(深圳)有限公司 | System and method for establishing multi-user conversation |
CN103634792A (en) * | 2012-08-27 | 2014-03-12 | 中国移动通信集团公司 | Method, device and system for monitoring WLAN network user state and client |
CN105897670A (en) * | 2015-11-13 | 2016-08-24 | 乐视云计算有限公司 | Website user login authentication method and system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6601169B2 (en) * | 1999-12-30 | 2003-07-29 | Clyde Riley Wallace, Jr. | Key-based secure network user states |
-
2017
- 2017-01-21 CN CN201710051827.9A patent/CN106850345B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1540544A (en) * | 2003-04-22 | 2004-10-27 | 联想(北京)有限公司 | Method for tracking and controlling users' online states and information |
CN101296200A (en) * | 2008-06-30 | 2008-10-29 | 腾讯科技(深圳)有限公司 | System and method for establishing multi-user conversation |
CN103634792A (en) * | 2012-08-27 | 2014-03-12 | 中国移动通信集团公司 | Method, device and system for monitoring WLAN network user state and client |
CN105897670A (en) * | 2015-11-13 | 2016-08-24 | 乐视云计算有限公司 | Website user login authentication method and system |
Also Published As
Publication number | Publication date |
---|---|
CN106850345A (en) | 2017-06-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6112196A (en) | Method and system for managing connections to a database management system by reusing connections to a database subsystem | |
US10237295B2 (en) | Automated event ID field analysis on heterogeneous logs | |
US7603474B2 (en) | Efficient endpoint matching using a header-to-bit conversion table | |
CN108183975B (en) | Domain name resolution method and system | |
CN102737119B (en) | The lookup method of URL(uniform resource locator), filter method and relevant device and system | |
CN102460398A (en) | Source classification for performing deduplication in a backup operation | |
EP1566035B1 (en) | Support of multiple native network protocol implementations in a single system | |
JP2008102795A (en) | File management device, system, and program | |
CN104468107A (en) | Method and device for verification data processing | |
CN105683941A (en) | Regulating enterprise database warehouse resource usage | |
US20080270483A1 (en) | Storage Management System | |
CN105227386B (en) | For dividing the method, apparatus and system of population statistics online user number | |
Chang et al. | Cloud computing storage backup and recovery strategy based on secure IoT and spark | |
US11080239B2 (en) | Key value store using generation markers | |
CN108243207B (en) | A kind of date storage method of network cloud disk | |
CN111694793A (en) | Log storage method and device and log query method and device | |
CN111585963A (en) | Data acquisition method, system and storage medium | |
CN106850345B (en) | Method for monitoring and inquiring network user state | |
CN101582881A (en) | Method and device for controlling access | |
CN114793244B (en) | Resource processing method, device, equipment and medium for block chain | |
CN101510896B (en) | Method for implementing instant message based on Web | |
US20200311132A1 (en) | Key value store using change values for data properties | |
US7313598B1 (en) | Method and apparatus for partial replication of directory information in a distributed environment | |
US20050240609A1 (en) | Method and apparatus for setting storage groups | |
CN109344596B (en) | LDAP-based multi-server management system and method |
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 |