CN111628905A - Data packet capturing method, device and equipment - Google Patents

Data packet capturing method, device and equipment Download PDF

Info

Publication number
CN111628905A
CN111628905A CN202010360004.6A CN202010360004A CN111628905A CN 111628905 A CN111628905 A CN 111628905A CN 202010360004 A CN202010360004 A CN 202010360004A CN 111628905 A CN111628905 A CN 111628905A
Authority
CN
China
Prior art keywords
service
data packet
capturing
network connection
network
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
CN202010360004.6A
Other languages
Chinese (zh)
Other versions
CN111628905B (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.)
Suzhou Magic Tower Network Technology Co ltd
Original Assignee
Suzhou Magic Tower Network 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 Suzhou Magic Tower Network Technology Co ltd filed Critical Suzhou Magic Tower Network Technology Co ltd
Priority to CN202010360004.6A priority Critical patent/CN111628905B/en
Publication of CN111628905A publication Critical patent/CN111628905A/en
Application granted granted Critical
Publication of CN111628905B publication Critical patent/CN111628905B/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
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/02Capturing of monitoring data
    • H04L43/022Capturing of monitoring data by sampling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0852Delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/12Network monitoring probes

Abstract

The application discloses a data packet capturing method, a data packet capturing device and data packet capturing equipment, relates to the technical field of computers, and can integrate a packet capturing process into service logic so as to flexibly capture a data packet in a game process. The method comprises the following steps: responding to a monitoring instruction of a network state, and acquiring network delay in a service scene which is mapped with a service characteristic field in network connection according to the service characteristic field carried by the monitoring instruction; judging whether the network delay under the service scene mapped with the service characteristic field reaches a delay threshold value configured in advance in the service scene; and if so, capturing the data packet in the service scene in the network connection.

Description

Data packet capturing method, device and equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a device for capturing a data packet.
Background
With the rapid development of the game industry, the network game can not leave the internet, the network with high bandwidth and high speed can improve the experience of the player on the network game, and in turn, the network blocking, time delay, passing the field and the like can cause the game to be blocked and even to be disconnected from the house, so that the online rate of the player can be greatly reduced, the game experience of the player is influenced, meanwhile, the network quality cannot be predicted, and great difficulty is brought to network positioning.
In the related technology, the data packet running in the game process is stored and used as a basis for post analysis, so that the network positioning and analysis can be helped to a certain extent. At present, two methods are mainly used for capturing data packets, one is a hardware method, a network data packet is copied to a designated port by using a port mirror image copying function of network equipment, and then the data packet is stored in file equipment, but the number of data packets of mirror images is huge, analysis is difficult, and additional capital investment is required for the file equipment for storing a large number of data packets; the other method is a software method, a network card of the server is subjected to packet capturing by using a software packet capturing tool, the software packet capturing tool runs as a single process, the size of a data packet can be specified through a series of commands, and the software packet capturing tool is responsible for capturing and storing the network data packet to a specified file, but the data packet in the game process cannot be captured flexibly because the packet capturing process runs outside the game process.
Disclosure of Invention
In view of this, the present application provides a method, an apparatus, and a device for capturing a data packet, and mainly aims to solve the problem that a data packet in a game process cannot be captured flexibly when a packet capturing process in the prior art runs outside a game process.
According to a first aspect of the present application, there is provided a method for fetching a data packet, the method comprising:
responding to a monitoring instruction of a network state, and acquiring network delay in a service scene which is mapped with a service characteristic field in network connection according to the service characteristic field carried by the monitoring instruction;
judging whether the network delay under the service scene mapped with the service characteristic field reaches a delay threshold value configured in advance in the service scene;
and if so, capturing the data packet in the service scene in the network connection.
According to a second aspect of the present application, a packet forwarding apparatus comprises:
the acquisition unit is used for responding to a monitoring instruction of a network state and acquiring network delay under a service scene which is mapped with a service characteristic field in network connection according to the service characteristic field carried by the monitoring instruction;
a judging unit, configured to judge whether the network delay in the service scenario mapped with the service feature field reaches a delay threshold preconfigured in the service scenario;
and the capturing unit is used for capturing the data packet in the service scene in the network connection if the time delay threshold value preset in the service scene is reached.
According to a third aspect of the present application, there is provided a computer device comprising a memory storing a computer program and a processor implementing the steps of the method of the first aspect when the computer program is executed.
According to a fourth aspect of the present application, there is provided a readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method of the first aspect described above.
By the technical scheme, compared with the conventional mode of grabbing the data packet by using a hardware method or a software method, the device and the equipment for grabbing the data packet provided by the application acquire the network delay under the service scene mapped with the service characteristic field in the network connection by monitoring the service characteristic field carried by the instruction, further judge that the network delay under the service scene mapped with the service characteristic field reaches the delay threshold value configured in advance in the service scene, grab the data packet under the service scene in the network connection, and start the data packet grabbing function only under the specific condition of reaching the delay threshold value, so that the hardware method is prevented from grabbing all network data packets, resources are occupied, meanwhile, the data packet grabbing is carried out by combining the service scene, so that the packet grabbing process runs in the game process, and according to the service logic of the current game scene, and flexibly capturing the data packet in the game process.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart illustrating a method for fetching a data packet according to an embodiment of the present application;
fig. 2 is a schematic flow chart illustrating another data packet fetching method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram illustrating a packet capture device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram illustrating another packet grabbing device according to an embodiment of the present disclosure;
fig. 5 is a schematic device structure diagram of a computer apparatus according to an embodiment of the present invention.
Detailed Description
The content of the invention will now be discussed with reference to a number of exemplary embodiments. It is to be understood that these examples are discussed only to enable those of ordinary skill in the art to better understand and thus implement the teachings of the present invention, and are not meant to imply any limitations on the scope of the invention.
As used herein, the term "include" and its variants are to be read as open-ended terms meaning "including, but not limited to. The term "based on" is to be read as "based, at least in part, on". The terms "one embodiment" and "an embodiment" are to be read as "at least one embodiment". The term "another embodiment" is to be read as "at least one other embodiment".
In a game application scene, in order to store data packets running in a game process as a basis for post analysis, the data packets in the game process network connection can be captured, and then the data is stored in file equipment for summarizing. At present, two methods are mainly used for capturing data packets, one is a hardware method, a network data packet is copied to a designated port by using a port mirror image copying function of network equipment, and then the data packet is stored in file equipment, but the number of data packets of mirror images is huge, analysis is difficult, and additional capital investment is required for the file equipment for storing a large number of data packets; the other method is a software method, a network card of the server is subjected to packet capturing by using a software packet capturing tool, the software packet capturing tool runs as a single process, the size of a data packet can be specified through a series of commands, and the software packet capturing tool is responsible for capturing and storing the network data packet to a specified file, but the data packet in the game process cannot be captured flexibly because the packet capturing process runs outside the game process.
In order to solve the above technical problem, this embodiment provides a method for fetching a data packet, as shown in fig. 1, where the method is applied to a server, and includes the following steps:
101. and responding to a monitoring instruction of a network state, and acquiring network delay in a service scene which is mapped with the service characteristic field in network connection according to the service characteristic field carried by the monitoring instruction.
The monitoring instruction can be triggered by a delay calculation module arranged at the server side and is used for monitoring the network state in the game process. In general, network connection is jammed due to network congestion and delay in the game process. In order to analyze the network delay before the network connection is in a stuck state, the network characteristics can be known to a certain extent by acquiring the network delay in the service scene in which the network connection is mapped with the service characteristic field, and the network delay is avoided by analyzing the network characteristics.
In the embodiment of the present invention, in order to analyze the network delay for the service scene of the game, a service feature field may be added in the monitoring instruction, and the service feature field may be set in combination with the service scene of the game, where the service scene of the game may include, but is not limited to, an interface scene, a map scene, a combat scene, a function scene, and the like, where the interface scene may be a scene in which a user enters different game interfaces, and may be set service feature fields such as a game hall, a copy, a cross-server battle, and the like, the map scene may be a scene in which a character walks or moves to execute a task during the game, and may be set service feature fields such as a field map, a main city map, a prefecture map, and the like, and the combat scene may be a scene in which characters fight against each other during the game, for example, a character, the functional scene mining industry is a scene in which players interact with each other based on characters in a game process, for example, the players chat, the players buy equipment, and the like, and the service scene is not limited herein.
The execution main body of the embodiment may be a capturing device or equipment of a data packet, and may be configured at a server, and in order to obtain network delays in different service scenarios, a monitoring instruction for network delays in corresponding service scenarios may be triggered based on the service feature field, so as to analyze network features in different service scenarios, so as to reduce the influence of network delays on a game process.
102. And judging whether the network delay under the service scene mapped with the service characteristic field reaches a delay threshold value configured in advance in the service scene.
Because different service operations need to be executed in different service scenes, and different network resources needed by the service scenes are caused by different complexity needed by the service operations, the service scenes with more complex service operations usually need to consume larger network resources, the probability of generating network delay is higher under normal conditions, the service scenes with simpler service operations do not need to consume excessive network resources, and the probability of generating network delay is smaller.
It can be understood that, in order to facilitate accurate configuration of network thresholds of different service scenarios, a delay threshold may be preconfigured for a service scenario based on the tolerance of a player to network delay by counting the tolerance of the player to network delay in a game process without using the service scenario, specifically, historical page data in the process of the player entering the service scenario in the game process may be queried, and a quit operation of the service scenario caused by network delay in the historical page data is monitored, where the quit operation indicates that the network delay of the user reaches a tolerance limit, and then a time record corresponding to the quit operation is extracted as the delay threshold preconfigured for the service scenario.
In the actual application process, with the continuous increase of the service scenes, the historical page data may not cover numerous service scenes, specifically, the condition of network delay generated in the service scenes in the game process can be realized, the delay threshold value pre-configured in the service scenes can be continuously adjusted, the delay threshold value can be pre-estimated by combining network resources occupied by the service scenes, and the accuracy of setting the game threshold value can be further improved.
103. And if so, capturing the data packet in the service scene in the network connection.
In the embodiment of the present invention, a packet capturing module may be specifically configured to control capturing a data packet in a service scenario in a network connection, the packet capturing module may be embedded in a server side for the server to use, and the packet capturing module may provide a start packet capturing interface and a stop packet capturing interface, when the start packet capturing interface is called by the packet capturing module, the packet capturing module starts one thread to control starting capturing a data packet in the service scenario in the network connection, and when the stop packet capturing interface is called by the packet capturing module, the packet capturing module starts another thread to control stopping capturing a data packet in the service scenario in the network connection.
It can be understood that the service end side is provided with the packet capturing module to start the capturing process of the thread control data packet, and the packet capturing module and the service logic in the game process can operate independently by using the thread form, so that the blocking of the service logic of the current network connection by the packet capturing module is avoided, and the flexibility of data packet capturing is improved to a certain extent.
Compared with the prior mode of grabbing the data packet by using a hardware method or a software method, the data packet grabbing method provided by the embodiment of the application acquires the network delay under the service scene which is mapped with the service characteristic field in the network connection by monitoring the service characteristic field carried by the instruction, further judges that the network delay under the service scene which is mapped with the service characteristic field reaches the delay threshold value configured in advance in the service scene, grabs the data packet under the service scene in the network connection, and starts the data packet grabbing function only when the specific condition of the delay threshold value is reached, so that the method avoids grabbing all network data packets by using the hardware method, occupies resources, and simultaneously grabs the data packet by combining the service scene, so that the packet grabbing process runs in the game process, and can grab the data packet according to the service logic of the current game scene, and flexibly capturing the data packet in the game process.
Further, as a refinement and an extension of the specific implementation of the foregoing embodiment, in order to fully describe the specific implementation process of the present embodiment, the present embodiment provides another method for fetching a data packet, as shown in fig. 2, the method includes:
201. and responding to a monitoring instruction of a network state, and generating a request data packet in a service scene mapped with the service characteristic field according to the service characteristic field carried by the monitoring instruction.
In the embodiment of the invention, in order to accurately acquire the network delay generated in the service scene, the request data packet in the service scene mapped with the service characteristic field can be generated by processing the service characteristic field, and the request data packet is used as a data medium in the network transmission process in the game process and can establish the connection of the game data between the server side and the client side. Typically, the server and client drive the game logic by exchanging game packets and analyzing the resulting packets. Therefore, interactive control in the game process needs to be completed by the server and the client side in cooperation through the data packet.
The process of processing the service characteristic field to form the request data packet in the service scene mapped with the service field is equivalent to the data packaging process, and the service characteristic field can be added into the game data according to the processing parameters by setting the processing parameters, such as the length of the data packet, the type of the data packet, the check code of the data packet, and the like, so as to form the request data packet in the service scene mapped with the service characteristic field.
It can be understood that the specific design process of the request data packet is divided according to the service scene in the game process, for the request data packet of the chat content, the server side needs to have broadcast data containing the service characteristic field in the chat service scene, and through the broadcast data, the server side can send the broadcast data to the client side; for the request data packet of the transaction function, because the transaction function covers more data, the server may generate a plurality of data packets for the transaction data including the service feature field in the service scenario of the transaction function, such as: a transaction application data packet, a transaction application information data packet, a transaction permission or rejection data packet, a transaction confirmation data packet, and the like.
In the actual application process, the processing process of the request data packet also needs to consider the usage rules of the data packet at the client and the server, some are used by one party and the other is not used by the other party, and some are used by both parties.
202. And sending the request data packet to the client, and recording the time for sending the request data packet and the time for receiving the response data packet.
The response data packet is sent by the client side for responding to the request data packet and received by the server side, and under the condition that the network state allows, after the request data packet is sent by the server side, the client side returns the response data packet at the first time when the request data packet is received and receives the response data packet by the server side, so that the difference between the time sent by the server side and the time for receiving the response data packet can reflect the network delay in the game process to a certain extent.
In the process of practical application, a delay calculation module arranged at a server side can send a request data packet to a client side at fixed time and receive a response data packet returned by the client side, and business logic is embedded into the delay module to realize the following steps, specifically, the server side can send the request data packet to the client side at fixed time and record the time for sending the request data packet; and the server receives the response data packet returned by the client and records the time for receiving the response data packet.
203. And acquiring the network delay in the service scene mapped with the service characteristic field in the network connection by calculating the difference between the time for sending the request data packet and the time for receiving the response data packet.
It can be understood that the request data packet carries a service feature field, which means that the request data packet and the response data packet transmitted between the client and the server both carry corresponding service context information and are mapped with the service context, so that the obtained network delay is also the network delay in the service context.
In the embodiment of the invention, because the real-time property of data packet transmission can not be ensured in the game process, the client side always returns the response data packet with a certain delay, and the network delay in the service scene mapped with the service characteristic field in the network connection can be obtained by calculating the difference between the time of sending the request data packet and the time of receiving the response data packet.
204. And a delay threshold value and a capture threshold value are configured in advance according to different service scenes.
In order to make the capture of the data packet more suitable for the service scene in the game process, the capture of the data packet is started only under specific conditions, wherein the delay threshold is a time threshold for responding to the data suitable for the service scene in network connection, and different delay thresholds are further set for different service scenes, for example, a longer delay threshold is set for a function scene, and a shorter delay threshold is set for a battle scene; similarly, the capture threshold here is a quantity threshold for capturing data packets applicable to a service scenario in network connection, and then different capture thresholds are set for different service scenarios, for example, for an interface scenario, part of data packets may be captured, and for a battle scenario, all data packets may be captured.
It can be understood that, in order to save resource occupation and more reasonably capture data packets in the game process, for a battle application scenario, factors such as battle time and the like can be considered to capture part of the data packets, for example, if the battle time in the PVP is short, all the data packets can be captured, and if the battle time in the PVP is long, part of the data packets can be captured.
205. And judging whether the network delay under the service scene mapped with the service characteristic field reaches a delay threshold value configured in advance in the service scene.
Specifically, in the process of practical application, the server may set a control module to execute a process of determining whether the network delay in a service scenario mapped with the service feature field reaches a delay threshold value pre-configured for the service scenario, the control module may be composed of three parts, i.e., an input part, a determination part and an output part, the input part is a network delay and a service feature field in a service scenario mapped with the network service feature field acquired by the delay calculation module, a delay threshold value suitable for the service scenario is determined from a configuration file loaded based on the service feature field, the configuration file records a delay threshold value and a capture threshold value pre-set for each service scenario, and further determines whether to start capturing a data packet or not according to comparison between the input network delay and the determined delay threshold value, and determines whether to stop capturing the data packet according to the capture threshold value, the output is an interface for calling the grabbing module to execute the starting grabbing of the data packet and stopping the grabbing process.
206. If so, calling a packet capturing interface, and starting to capture the data packet in the service scene in the network connection.
The packet capturing module comprises a thread pool which is set for data packet capturing in advance, and the thread pool comprises a capturing thread which is started and a capturing thread which is stopped. Specifically, for the process of starting data packet capture, a capture starting thread can be selected from a thread pool preset for data capture by calling a starting interface of a capture module; and responding to an execution instruction for starting the capturing thread, and starting to capture the data packet in the service scene in the network connection.
In the actual application process, the server can set a capture module to execute the capture starting process of the data packet, wherein a thread pool is deployed in the capture module and is only used by the server to provide a starting interface, when the control module calls the starting interface of the capture module, the capture of the data packet in the service scene in the connection is started, and the captured data packet is stored to the local server or the designated file server for subsequent analysis and use.
207. In the process of capturing the data packets in the service scene in the network connection, the number of the captured data packets in the service scene in the network connection is obtained in real time.
208. And stopping capturing the data packets in the service scene in the network connection by comparing the number of the captured data packets in the service scene in the network connection with the capture threshold.
In the embodiment of the present invention, it is specifically determined whether the number of captured packets in a service scenario in network connection reaches a capture threshold; if so, stopping capturing the data packet in the service scene in the network connection by calling the stopping interface of the packet capturing module.
Correspondingly, for the process of stopping data packet capture, specifically, a capture stopping thread can be selected from a thread pool which is set for data capture in advance by calling a stopping interface of a packet capture module; and stopping grabbing the data packet in the service scene in the network connection in response to the execution instruction of the thread stopping grabbing.
In the actual application process, the server may set a capture module to perform a capture stopping process of the data packet, where the capture module is equivalent to a thread pool and is used only at the server to provide a stop interface, and when the control module calls the stop interface of the capture module, the capture of the data packet in the service scene during connection is stopped.
The capturing process of the data packet provided by the embodiment of the invention can control the capturing time of the data packet through the control module arranged at the server, and fuse the service logic in the game process into the process of capturing the packet, can adaptively use the packet capturing module to start and close the packet capturing function, reduce the capturing quantity of the data packet, save the resource cost, and provide great help for the post analysis because the captured data packet usually exceeds the delay threshold value specified by the service logic for the network delay.
Further, as a specific implementation of the method in fig. 1 and fig. 2, an embodiment of the present application provides a device for fetching a data packet, as shown in fig. 3, the device includes: an acquisition unit 31, a judgment unit 32, and a grasping unit 33.
The obtaining unit 31 may be configured to, in response to a monitoring instruction of a network state, obtain, according to a service feature field carried by the monitoring instruction, a network delay in a service scenario mapped with the service feature field in a network connection;
a determining unit 32, configured to determine whether the network delay in the service scenario mapped with the service feature field reaches a delay threshold preconfigured in the service scenario;
the capturing unit 33 may be configured to capture a data packet in a service scenario in the network connection if a delay threshold value preconfigured in the service scenario is reached.
Compared with the prior art that the data packet is captured by a hardware method or a software method, the data packet capturing device provided by the embodiment of the invention acquires the network delay under the service scene mapped with the service characteristic field in the network connection by monitoring the service characteristic field carried by the instruction, and further captures the data packet under the service scene in the network connection when the network delay under the service scene mapped with the service characteristic field reaches the delay threshold value configured in advance in the service scene, because the data packet capturing function is started only when the specific condition of the delay threshold value is reached, the hardware method is prevented from capturing all network data packets and occupying resources, and the data packet capturing is carried out by combining the service scene, so that the packet capturing process runs in the game process, and the data packet capturing device can capture the data packet according to the service logic of the current game scene, and flexibly capturing the data packet in the game process.
In a specific application scenario, as shown in fig. 4, the obtaining unit 31 includes:
the generating module 311 may be configured to generate a request data packet in a service scenario mapped with the service feature field according to the service feature field carried by the monitoring instruction;
a recording module 312, configured to send the request data packet to the client, and record time for sending the request data packet and time for receiving a response data packet, where the response data packet is sent by the client in response to the request data packet;
the calculating module 313 may be configured to obtain a network delay in a service scenario mapped with the service feature field in the network connection by calculating a difference between the time of sending the request data packet and the time of receiving the response data packet.
In a specific application scenario, as shown in fig. 4, the recording module 312 includes:
the first recording submodule 3121 may be configured to send the request data packet to the client at regular time, and record time for sending the request data packet;
the second recording sub-module 3122 may be configured to receive a response packet returned by the client, and record a time for receiving the response packet.
In a specific application scenario, as shown in fig. 4, the apparatus further includes:
the configuration unit 34 may be configured to, before the determining whether the network delay in the service scenario mapped with the service feature field reaches a delay threshold preconfigured for the service scenario, preconfigured a delay threshold and a capture threshold for different service scenarios, where the delay threshold is a time threshold for responding to data applicable to the service scenario in the network connection, and the capture threshold is a quantity threshold for capturing data packets applicable to the service scenario in the network connection.
In a specific application scenario, as shown in fig. 4, the grabbing unit 33 includes:
the starting module 331 is configured to start capturing a data packet in a service scenario in the network connection by calling a starting interface of the packet capturing module;
the obtaining module 332 may be configured to obtain, in real time, the number of data packets captured in the service scenario in the network connection in the process of capturing the data packets in the service scenario in the network connection;
the stopping module 333 may be configured to stop capturing the data packets in the service scenario in the network connection by comparing the number of captured data packets in the service scenario in the network connection with the capture threshold.
In a specific application scenario, as shown in fig. 4, the packet capturing module includes a thread pool set for capturing a data packet in advance, the thread pool includes a capture thread start and a capture thread stop, and the starting module 331 includes:
the selecting sub-module 3311 may be configured to select an open fetch thread from the thread pool set for data fetch in advance by calling an open interface of the packet fetch module;
the starting sub-module 3312 may be configured to start, in response to the execution instruction for starting the capturing thread, capturing the data packet in the service scenario in the network connection.
In a specific application scenario, as shown in fig. 4, the stopping module 333 includes:
the determining sub-module 3331 may be configured to determine whether the number of captured data packets in the service scenario in the network connection reaches the capture threshold;
the stopping sub-module 3332 may be configured to, if the capture threshold is reached, stop capturing the data packet in the service scenario in the network connection by calling a stopping interface of the packet capturing module.
In a specific application scenario, the stopping sub-module 3332 may be specifically configured to select a thread to stop fetching from the thread pool set for data fetching in advance by calling a stopping interface of the packet fetching module;
the stopping sub-module 3332 may be further configured to stop, in response to the instruction for stopping fetching the thread, fetching the data packet in the service scenario in the network connection.
In a specific application scenario, as shown in fig. 4, the service scenario is a game scenario, the service feature field is a feature field set for the game scenario, and the configuration unit 34 includes:
the statistical module 341 may be configured to count tolerance data of the user to the network delay in the process of entering different game scenes, where the tolerance data is a limit value of the tolerance time of the user to the network delay;
the configuration module 342 may be configured to configure delay thresholds in different game scenarios based on the user's tolerance time limit for network delay.
In a specific application scenario, the configuration module 342 may be specifically configured to query historical page data of a user in a process of entering different game scenarios;
the configuration module 342 may be further configured to, if a quit operation of the user in the historical page data due to the network delay is monitored, extract time data corresponding to the quit operation as tolerance data of the user to the network delay in the game playing process.
It should be noted that other corresponding descriptions of the functional units related to the apparatus for fetching a data packet provided in this embodiment may refer to the corresponding descriptions in fig. 1 to fig. 2, and are not described herein again.
Based on the above-mentioned methods shown in fig. 1-2, correspondingly, the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for fetching the data packet shown in fig. 1-2 is implemented.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the implementation scenarios of the present application.
Based on the method shown in fig. 1-2 and the virtual device embodiment shown in fig. 3-4, in order to achieve the above object, an embodiment of the present application further provides an entity device for capturing a data packet, which may be specifically a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, and the entity device includes a storage medium and a processor; a storage medium for storing a computer program; a processor for executing a computer program to implement the above-mentioned method for fetching a data packet as shown in fig. 1-2.
Optionally, the entity device may further include a user interface, a network interface, a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), etc.
In an exemplary embodiment, referring to fig. 5, the entity device 400 includes a communication bus, a processor, a memory, and a communication interface, and may further include an input/output interface and a display device, wherein the functional units may communicate with each other through the bus. The memory stores computer programs, and the processor is used for executing the programs stored in the memory and executing the painting mounting method in the embodiment.
Those skilled in the art will appreciate that the physical device structure provided in this embodiment for capturing a data packet does not constitute a limitation to the physical device, and may include more or fewer components, or combine some components, or arrange different components.
The storage medium may further include an operating system and a network communication module. The operating system is a program for managing hardware and software resources of the actual device for store search information processing, and supports the operation of the information processing program and other software and/or programs. The network communication module is used for realizing communication among components in the storage medium and communication with other hardware and software in the information processing entity device.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and can also be implemented by hardware. By applying the technical scheme, compared with the prior art, the method and the device have the advantages that the network delay under the service scene which is mapped with the service characteristic field in the network connection is obtained through the service characteristic field carried by the monitoring instruction, and then when the network delay under the service scene which is mapped with the service characteristic field reaches the delay threshold value which is configured in advance in the service scene, the data packet under the service scene in the network connection is captured.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.
Embodiments of the present invention also include these and other aspects as specified in the following numbered clauses:
1. a method for grabbing a data packet comprises the following steps:
responding to a monitoring instruction of a network state, and acquiring network delay in a service scene which is mapped with a service characteristic field in network connection according to the service characteristic field carried by the monitoring instruction;
judging whether the network delay under the service scene mapped with the service characteristic field reaches a delay threshold value configured in advance in the service scene;
and if so, capturing the data packet in the service scene in the network connection.
2. The method according to clause 1, wherein the obtaining, according to the service characteristic field carried by the monitoring instruction, the network delay in the service scenario mapped with the service characteristic field in the network connection specifically includes:
generating a request data packet in a service scene mapped with the service characteristic field according to the service characteristic field carried by the monitoring instruction;
sending the request data packet to a client, and recording the time for sending the request data packet and the time for receiving a response data packet, wherein the response data packet is sent by the client for responding to the request data packet;
and acquiring the network delay in the service scene mapped with the service characteristic field in the network connection by calculating the difference between the time for sending the request data packet and the time for receiving the response data packet.
3. The method according to clause 2, wherein the sending the request packet to the client and recording the time of sending the request packet and the time of receiving the response packet specifically includes:
the request data packet is sent to the client regularly, and the time for sending the request data packet is recorded;
and receiving a response data packet returned by the client, and recording the time for receiving the response data packet.
4. The method according to clause 1, wherein before the determining whether the network delay in the service scenario mapped with the service characteristic field reaches a delay threshold preconfigured for the service scenario, the method further comprises:
and a delay threshold and a capture threshold are configured in advance for different service scenes, wherein the delay threshold is a time threshold for responding to data applicable to the service scenes in network connection, and the capture threshold is a quantity threshold for capturing data packets applicable to the service scenes in the network connection.
5. The method according to clause 4, wherein the capturing of the data packet in the service scenario in the network connection specifically includes:
calling a packet capturing interface, and starting to capture a data packet in a service scene in network connection;
acquiring the quantity of data packets grabbed under a service scene in the network connection in real time in the process of grabbing the data packets under the service scene in the network connection;
and stopping capturing the data packets in the service scene in the network connection by comparing the number of the captured data packets in the service scene in the network connection with the capture threshold.
6. The method according to clause 5, wherein the packet capturing interface is interfaced with a thread pool which is set for capturing a data packet in advance, the thread pool includes a capturing thread which is started and a capturing thread which is stopped, and the invoking of the packet capturing interface starts capturing the data packet in a service scene in the network connection, specifically including:
calling a packet capturing interface, and selecting and starting a capturing thread from the thread pool which is set for data capturing in advance;
and responding to the execution instruction for starting the capturing thread, and starting to capture the data packet in the service scene in the network connection.
7. The method according to clause 4, wherein the stopping of capturing the data packets in the service scenario in the network connection by comparing the number of captured data packets in the service scenario in the network connection with the capture threshold preconfigured in the service scenario specifically includes:
judging whether the quantity of the captured data packets under the service scene in the network connection reaches the capture threshold value;
if so, calling a packet capturing interface, and stopping capturing the data packet in the service scene in the network connection.
8. The method according to clause 6, wherein the invoking of the packet capturing interface stops capturing the data packet in the service scenario in the network connection, specifically comprising:
calling a packet capturing interface, and selecting a capturing stopping thread from the thread pool which is set for data capturing in advance;
and stopping grabbing the data packet in the service scene in the network connection in response to the execution instruction of the thread stopping grabbing.
9. The method of any of clauses 1-8, wherein the business scenario is a game scenario and the business feature field is a feature field set for the game scenario.
10. The method according to clause 9, wherein the pre-configuring the delay threshold for different service scenarios specifically includes:
counting tolerance data of the user to network delay in the process of entering different game scenes, wherein the tolerance data is a tolerance time limit value of the user to the network delay;
configuring delay thresholds in different game scenarios based on the user's tolerance time limit to network delay.
11. The method according to clause 10, wherein the counting tolerance data of the user to the network delay in entering different game scenes specifically includes:
querying historical page data of a user in the process of entering different game scenes;
if the exit operation of the user in the historical page data, which is generated due to the network delay, is monitored, extracting time data corresponding to the exit operation as tolerance data of the user to the network delay in the game entering process.
12. A packet grabber, comprising:
the acquisition unit is used for responding to a monitoring instruction of a network state and acquiring network delay under a service scene which is mapped with a service characteristic field in network connection according to the service characteristic field carried by the monitoring instruction;
a judging unit, configured to judge whether the network delay in the service scenario mapped with the service feature field reaches a delay threshold preconfigured in the service scenario;
and the capturing unit is used for capturing the data packet in the service scene in the network connection if the time delay threshold value preset in the service scene is reached.
13. The apparatus according to clause 12, wherein the acquiring unit includes:
the generating module is used for generating a request data packet in a service scene mapped with the service characteristic field according to the service characteristic field carried by the monitoring instruction;
the recording module is used for sending the request data packet to the client and recording the time for sending the request data packet and the time for receiving a response data packet, wherein the response data packet is sent by the client in response to the request data packet;
and the computing module is used for obtaining the network delay in the service scene which is mapped with the service characteristic field in the network connection by computing the difference between the time for sending the request data packet and the time for receiving the response data packet.
14. The apparatus of clause 13, wherein the logging module comprises:
the first recording submodule is used for sending the request data packet to the client at regular time and recording the time for sending the request data packet;
and the second recording submodule is used for receiving the response data packet returned by the client and recording the time for receiving the response data packet.
15. The apparatus of clause 12, wherein the apparatus further comprises:
and a configuration unit, configured to pre-configure a delay threshold and a capture threshold for different service scenarios before the network delay in the service scenario mapped with the service feature field is determined to reach a delay threshold pre-configured for the service scenario, where the delay threshold is a time threshold for responding to data applicable to the service scenario in network connection, and the capture threshold is a quantity threshold for capturing data packets applicable to the service scenario in network connection.
16. The apparatus of clause 15, wherein the grasping unit comprises:
the starting module is used for starting to capture the data packet in the service scene in the network connection by calling the starting interface of the packet capturing module;
the acquisition module is used for acquiring the number of the data packets captured in the service scene in the network connection in real time in the process of capturing the data packets in the service scene in the network connection;
and the stopping module is used for stopping capturing the data packets in the service scene in the network connection by comparing the number of the captured data packets in the service scene in the network connection with the capturing threshold.
17. The apparatus according to clause 16, wherein the packet capturing module includes a thread pool set for data packet capturing in advance, the thread pool including a start capturing thread and a stop capturing thread, the start module includes:
the selecting submodule is used for selecting an open capturing thread from the thread pool which is set for data capturing in advance by calling an open interface of the packet capturing module;
and the starting submodule is used for responding to the execution instruction for starting the capturing thread and starting to capture the data packet in the service scene in the network connection.
18. The apparatus of clause 15, wherein the stop module comprises:
the judging submodule is used for judging whether the quantity of the captured data packets under the service scene in the network connection reaches the capture threshold value;
and the stopping submodule is used for stopping grabbing the data packet in the service scene in the network connection by calling a stopping interface of the packet grabbing module if the grabbing threshold is reached.
19. The apparatus according to clause 18, wherein the stop sub-module is specifically configured to select a fetch-stop thread from the thread pool set for data fetching in advance by calling a stop interface of a packet fetching module;
the stopping submodule is specifically configured to stop, in response to the instruction for stopping the capturing of the thread, capturing the data packet in the service scenario in the network connection.
20. The apparatus according to any one of clauses 12-19, wherein the service scenario is a game scenario, the service feature field is a feature field set for the game scenario, and the configuration unit includes:
the statistical module is used for counting tolerance data of the user to network delay in the process of entering different game scenes, and the tolerance data is a tolerance time limit value of the user to the network delay;
and the configuration module is used for configuring delay thresholds in different game scenes based on the tolerance time limit value of the user to the network delay.
21. The apparatus according to clause 20, wherein the configuration module is specifically configured to query historical page data of the user during entering different game scenarios;
the configuration module is specifically configured to, if a quitting operation of the user in the historical page data due to network delay is monitored, extract time data corresponding to the quitting operation as tolerance data of the user to the network delay in the game entering process.
22. A computer device comprising a memory storing a computer program and a processor implementing the steps of the method of capturing a data packet of any of clauses 1 to 11 when executing the computer program.
23. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of fetching a data package according to any one of clauses 1 to 11.

Claims (10)

1. A method for fetching a data packet, comprising:
responding to a monitoring instruction of a network state, and acquiring network delay in a service scene which is mapped with a service characteristic field in network connection according to the service characteristic field carried by the monitoring instruction;
judging whether the network delay under the service scene mapped with the service characteristic field reaches a delay threshold value configured in advance in the service scene;
and if so, capturing the data packet in the service scene in the network connection.
2. The method according to claim 1, wherein the obtaining, according to the service feature field carried by the monitoring instruction, the network delay in a service scenario in which the service feature field is mapped in a network connection specifically includes:
generating a request data packet in a service scene mapped with the service characteristic field according to the service characteristic field carried by the monitoring instruction;
sending the request data packet to a client, and recording the time for sending the request data packet and the time for receiving a response data packet, wherein the response data packet is sent by the client for responding to the request data packet;
and acquiring the network delay in the service scene mapped with the service characteristic field in the network connection by calculating the difference between the time for sending the request data packet and the time for receiving the response data packet.
3. The method according to claim 2, wherein the sending the request packet to the client and recording the time of sending the request packet and the time of receiving the response packet specifically comprises:
the request data packet is sent to the client regularly, and the time for sending the request data packet is recorded;
and receiving a response data packet returned by the client, and recording the time for receiving the response data packet.
4. The method of claim 1, wherein before the determining whether the network delay in the service scenario mapped with the service feature field reaches a delay threshold preconfigured for the service scenario, the method further comprises:
and a delay threshold and a capture threshold are configured in advance for different service scenes, wherein the delay threshold is a time threshold for responding to data applicable to the service scenes in network connection, and the capture threshold is a quantity threshold for capturing data packets applicable to the service scenes in the network connection.
5. The method according to claim 4, wherein the capturing the data packet in the service scenario in the network connection specifically includes:
calling a packet capturing interface, and starting to capture a data packet in a service scene in network connection;
acquiring the quantity of data packets grabbed under a service scene in the network connection in real time in the process of grabbing the data packets under the service scene in the network connection;
and stopping capturing the data packets in the service scene in the network connection by comparing the number of the captured data packets in the service scene in the network connection with the capture threshold.
6. The method according to claim 5, wherein the packet capturing interface is interfaced with a thread pool that is set for capturing a data packet in advance, the thread pool includes starting a capturing thread and stopping the capturing thread, and the invoking of the packet capturing interface starts capturing the data packet in a service scenario in the network connection, specifically including:
calling a packet capturing interface, and selecting and starting a capturing thread from the thread pool which is set for data capturing in advance;
and responding to the execution instruction for starting the capturing thread, and starting to capture the data packet in the service scene in the network connection.
7. The method according to claim 4, wherein the stopping of capturing the data packets in the service scenario in the network connection by comparing the number of captured data packets in the service scenario in the network connection with a capture threshold preconfigured in the service scenario comprises:
judging whether the quantity of the captured data packets under the service scene in the network connection reaches the capture threshold value;
if so, calling a packet capturing interface, and stopping capturing the data packet in the service scene in the network connection.
8. An apparatus for fetching a data packet, comprising:
the acquisition unit is used for responding to a monitoring instruction of a network state and acquiring network delay under a service scene which is mapped with a service characteristic field in network connection according to the service characteristic field carried by the monitoring instruction;
a judging unit, configured to judge whether the network delay in the service scenario mapped with the service feature field reaches a delay threshold preconfigured in the service scenario;
and the capturing unit is used for capturing the data packet in the service scene in the network connection if the time delay threshold value preset in the service scene is reached.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program implements the steps of the method for fetching a data packet according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for fetching a data packet according to any one of claims 1 to 7.
CN202010360004.6A 2020-04-30 2020-04-30 Data packet capturing method, device and equipment Active CN111628905B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010360004.6A CN111628905B (en) 2020-04-30 2020-04-30 Data packet capturing method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010360004.6A CN111628905B (en) 2020-04-30 2020-04-30 Data packet capturing method, device and equipment

Publications (2)

Publication Number Publication Date
CN111628905A true CN111628905A (en) 2020-09-04
CN111628905B CN111628905B (en) 2022-05-31

Family

ID=72272996

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010360004.6A Active CN111628905B (en) 2020-04-30 2020-04-30 Data packet capturing method, device and equipment

Country Status (1)

Country Link
CN (1) CN111628905B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112600735A (en) * 2020-12-14 2021-04-02 北京信而泰科技股份有限公司 Network delay testing method, device and system
CN114051008A (en) * 2021-10-27 2022-02-15 上海寰创通信科技股份有限公司 System for reducing game service time delay of wireless network
CN114051008B (en) * 2021-10-27 2024-05-03 上海寰创通信科技股份有限公司 System for reducing game service time delay of wireless network

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102694668A (en) * 2011-03-22 2012-09-26 中兴通讯股份有限公司 Method and apparatus for voice quality monitoring
US20140256420A1 (en) * 2013-03-11 2014-09-11 Microsoft Corporation Univied game preview
US20150209670A1 (en) * 2014-01-30 2015-07-30 Gree, Inc. Game management method, game management system, and game management program
US20160045826A1 (en) * 2007-12-05 2016-02-18 Sony Computer Entertainment America Llc System and Method for Retaining System State
CN109481935A (en) * 2018-12-17 2019-03-19 网易(杭州)网络有限公司 Game data processing method and processing device
CN110839017A (en) * 2019-10-21 2020-02-25 腾讯科技(深圳)有限公司 Proxy IP address identification method, device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160045826A1 (en) * 2007-12-05 2016-02-18 Sony Computer Entertainment America Llc System and Method for Retaining System State
CN102694668A (en) * 2011-03-22 2012-09-26 中兴通讯股份有限公司 Method and apparatus for voice quality monitoring
US20140256420A1 (en) * 2013-03-11 2014-09-11 Microsoft Corporation Univied game preview
US20150209670A1 (en) * 2014-01-30 2015-07-30 Gree, Inc. Game management method, game management system, and game management program
CN109481935A (en) * 2018-12-17 2019-03-19 网易(杭州)网络有限公司 Game data processing method and processing device
CN110839017A (en) * 2019-10-21 2020-02-25 腾讯科技(深圳)有限公司 Proxy IP address identification method, device, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112600735A (en) * 2020-12-14 2021-04-02 北京信而泰科技股份有限公司 Network delay testing method, device and system
CN112600735B (en) * 2020-12-14 2022-08-09 北京信而泰科技股份有限公司 Network delay testing method, device and system
CN114051008A (en) * 2021-10-27 2022-02-15 上海寰创通信科技股份有限公司 System for reducing game service time delay of wireless network
CN114051008B (en) * 2021-10-27 2024-05-03 上海寰创通信科技股份有限公司 System for reducing game service time delay of wireless network

Also Published As

Publication number Publication date
CN111628905B (en) 2022-05-31

Similar Documents

Publication Publication Date Title
CN109152095B (en) Wireless network connection method for terminal
CN104602131A (en) Barrage processing method and system
CN112291520B (en) Abnormal event identification method and device, storage medium and electronic device
CN109660823A (en) Video distribution method, apparatus, electronic equipment and storage medium
CN108933948A (en) A kind of video playing progress synchronous method and device
CN103731631B (en) The method, apparatus and system of a kind of transmitting video image
CN110457229B (en) Game performance monitoring method and device, electronic equipment and storage medium
CN105451071A (en) Video stream processing method, device and system
CN112583898A (en) Business process arranging method and device and readable medium
CN111324886A (en) Service request processing method and device and server
US10681400B2 (en) Method and device for transmitting video
CN115023699A (en) Malicious process detection method and device, electronic device and storage medium
CN111628905B (en) Data packet capturing method, device and equipment
CN111447201A (en) Scanning behavior recognition method and device, electronic equipment and storage medium
CN109589606A (en) A kind of information processing method and equipment, system
CN109304035B (en) Game time length obtaining method and device, terminal equipment and storage medium
CN109040672B (en) Video playing method and device
CN113608990B (en) Terminal performance detection method, device and storage medium
CN103582170B (en) The method and apparatus of communication connection is provided for multiple candidate applications in a mobile device
CN107168648B (en) File storage method and device and terminal
CN112073335B (en) Game data connection card pause processing system and method under big data support
WO2017088382A1 (en) Data processing method and device
CN106776010B (en) Resource allocation method and terminal
CN112861612A (en) Method and device for shooting image, electronic equipment and storage medium
CN114051624A (en) Method, device, equipment and storage medium for detecting game props on game area

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