Data volume determination method, and apparatus, device and medium

By constructing a proxy object for the socket object, the problem of not being able to obtain the amount of data transmitted by the socket is solved, and accurate statistics on the amount of data transmitted by the socket are realized, especially network traffic statistics of applications and third-party SDKs.

WO2025230468A1PCT designated stage Publication Date: 2025-11-06LEMON INC(GB)
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/SG2025/050286
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-30
Filing Date
2025-04-29
Publication Date
2025-11-06

AI Technical Summary

Technical Problem

Existing socket-based communication solutions cannot obtain the amount of data transmitted through the socket when the socket is invoked, resulting in missing traffic statistics.

Method used

By using reflection to obtain instance members of the target socket object in operation, a proxy object is constructed. The data transfer function of the proxy object includes a transfer part and a data volume determination part. The instance members of the target socket object are replaced to achieve data transfer and data volume determination.

Benefits of technology

It enables accurate statistics on the amount of data transmitted through sockets, including data traffic from the application itself and third-party SDKs accessing the network, solving the problem of missing traffic statistics and providing more refined data traffic statistics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SG2025050286_06112025_PF_FP_ABST
    Figure SG2025050286_06112025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a data volume determination method, and an apparatus, a device and a medium. A specific embodiment of the method comprises: acquiring an instance member in a running target socket object by means of reflection, and constructing a proxy object corresponding to the instance member, wherein a data transmission function of the proxy object comprises a transmission part and a data volume determination part, the transmission part transmitting data by means of calling a data transmission function of the instance member, and the data volume determination part being used for determining the data volume of the data transmitted by the transmission part; and replacing the instance member in the target socket object with the proxy object, so as to transmit the data by means of the data transfer function of the proxy object, and determine the data volume of the data transmitted by the transmission part. By means of the method, the volume of data transmitted by means of a socket can be acquired by means of the socket itself.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] A data quantity determination method, device, equipment and medium The present application claims priority to the Chinese patent application No. 202410543761.5, filed on April 30, 2024, and entitled "A data quantity determination method, device, equipment and medium", the whole content of which is incorporated herein by reference. TECHNICAL FIELD The embodiments of the present disclosure relate to the field of network access technology, and in particular to a data quantity determination method, device, equipment and medium. BACKGROUND The existing socket communication scheme cannot obtain the data quantity transmitted through the socket when the socket is called. SUMMARY The embodiments of the present disclosure describe a data quantity determination method, device, equipment and medium. According to a first aspect, a data quantity determination method is provided, comprising: obtaining an instance member in a target socket object in operation through reflection, constructing a proxy object corresponding to the instance member, a data transmission function of the proxy object comprising a transmission part and a data quantity determination part, the transmission part transmitting data by calling a data transmission function of the instance member, and the data quantity determination part being configured to determine the data quantity of the data transmitted by the transmission part; and replacing the instance member in the target socket object with the proxy object, for transmitting data through the data transmission function of the proxy object and determining the data quantity of the transmitted data. According to a second aspect, a data quantity determination device is provided, comprising: a proxy unit configured to obtain an instance member in a target socket object in operation through reflection, construct a proxy object corresponding to the instance member, a data transmission function of the proxy object comprising a transmission part and a data quantity determination part, the transmission part transmitting data by calling a data transmission function of the instance member, and the data quantity determination part being configured to determine the data quantity of the data transmitted by the transmission part; and a statistics unit configured to replace the instance member in the target socket object with the proxy object, for transmitting data through the data transmission function of the proxy object and determining the data quantity of the transmitted data. According to a third aspect, a computer readable storage medium is provided, which stores a computer program, and when the computer program is executed in a computer, the computer executes the method of the first aspect. According to a fourth aspect, an electronic device is provided, comprising a memory and a processor, the memory stores executable code, and when the processor executes the executable code, the method of the first aspect is implemented. According to the embodiments of the present disclosure, a data quantity determination method, device, equipment and medium are provided.First, an instance member in a target socket object in operation is acquired through reflection, a proxy object corresponding to the instance member is constructed, and a data transmission function of the proxy object includes a transmission part and a data amount determination part. The transmission part transmits data by calling a data transmission function of the instance member, and the data amount determination part is used to count the data amount of the data transmitted by the transmission part. Then, the instance member in the target socket object is replaced with the proxy object, which is used to transmit data through the data transmission function of the proxy object and confirm the data amount of the transmitted data. Through the method, the data amount transmitted through the socket can be acquired when the socket is called. BRIEF DESCRIPTION OF DRAWINGS

[0002] FIG. 4 shows a flowchart of a data amount determination method according to an embodiment of the present disclosure;

[0003] FIG. 6 shows a structural schematic diagram of an electronic device suitable for implementing embodiments of the present disclosure; FIG. 7 shows a structural schematic diagram of a storage medium suitable for implementing embodiments of the present disclosure. In the following, the technical solutions provided in the present specification are described in further detail in combination with the drawings and embodiments. It can be understood that the specific embodiments described herein are merely used to explain the related application, but not to limit the application. In addition, it should be noted that, for the convenience of description, only the parts related to the application are shown in the drawings. It should be noted that, in the case of no conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other. In the description of the implementation manner of the present disclosure, the term "comprises" and similar terms should be understood as open inclusion, i.e. "comprises but is not limited to". The term "based on" should be understood as "at least partially based on". The term "one implementation" or "the implementation" should be understood as "at least one implementation". The term "some implementations" should be understood as "at least some implementations". The following may also include other explicit and implicit definitions. In many scenarios of application running, it is desired to obtain the data amount of data transmitted or received by the application through the network (or referred to as the data flow of the application, or simply referred to as the application flow) in the process of application running. The existing scheme for counting the data flow of the application usually obtains the data amount transmitted or received by the application through the interface provided by the network layer of the terminal system, for example, when the application is running. FIG. 1 shows a schematic diagram of an application flow counting scheme. As shown in the example of FIG. 1, the application can obtain the data amount transmitted or received by the application by calling the interface provided by the network layer of the native terminal system in the running process. However, this scheme has the following problems, only the statistical value of the data amount transmitted or received by the entire application can be obtained. Another application flow counting scheme mainly obtains the data amount transmitted or received by the application through a specific network request framework when the application calls the specific network request framework for network data transmission. FIG. 2 shows a schematic diagram of another application flow counting scheme. As shown in FIG. 2, when the application calls the specific network framework, the data amount transmitted or received by the application through the network can be counted by the specific network request framework above the network application layer. However, this scheme can usually only calculate the data amount transmitted or received by the code of the application itself. Therefore, the problem of flow counting omission often exists. In order to solve the above technical problems, the present disclosure provides a data amount determination method. Socket refers to an abstract component corresponding to a communication endpoint for bidirectional communication between applications on different hosts in a network.By calling a socket, a software application above an application layer can exchange data by using a network protocol. Between existing software applications, network communication is usually performed by sockets, even if the network request framework or the third-party SDK is usually performed by calling a socket to send and receive network data. However, the function (or method) for sending or receiving data included in the existing socket can usually only perform the operation of sending or receiving data, and cannot count the amount of data sent or received through the socket. FIG. 3 shows a schematic diagram of a method for determining the amount of data according to an embodiment of the present disclosure. As shown in the example of FIG. 3, the instance member in the currently running socket object can be obtained by reflection, and then a proxy object corresponding to the instance member is constructed. The sending data function and the receiving data function of the proxy object can be constructed based on the sending data function and the receiving data function of the instance member and the data amount counting code. The sending data function and the receiving data function of the proxy object can be used not only for sending or receiving data, but also for counting the amount of data received or sent through them. Then, the instance member in the socket object can be replaced by the proxy object (or proxy member), so that the data transmitted (including sent and received) through the socket object can be directly counted. In some embodiments, the data amount counting code can also be used to determine the data flow of the application for different access domain names, or the data flow of the application for different access addresses. The advantage of this method is that, on the one hand, compared with the traditional scheme for counting the application flow of the specific network request framework, not only the data flow of the network accessed by the application itself code can be counted, but also the data flow of the network accessed by the third-party SDK called by the application can be counted, thereby solving the problem of missing flow statistics. On the other hand, compared with the traditional scheme for counting the application flow through the network layer interface, more detailed data flow statistics values can be obtained, for example, the data flow statistics values for different access domain names or different access addresses can be obtained. The detailed process of this method is further described below.

[0004] S 4 illustrates a flowchart of a method for determining data volume according to an embodiment of the present disclosure. As shown in FIG. 4, the method comprises at least the following steps: in step S401, obtaining an instance member in a target socket object in running through reflection, constructing a proxy object corresponding to the instance member, a data transmission function of the proxy object comprising a transmission part and a data volume determination part, the transmission part transmitting data by calling a data transmission function of the instance member, and the data volume determination part being configured to determine data volume of data transmitted by the transmission part; and in step S403, replacing the instance member in the target socket object with the proxy object, so as to transmit data through the data transmission function of the proxy object and determine data volume of the transmitted data. First, in step S401, an instance member in a target socket object in running is obtained through reflection, and a proxy object corresponding to the instance member is constructed. The data transmission function of the proxy object can comprise a transmission part and a data volume determination part, the transmission part can transmit data by calling a data transmission function of the instance member, and the data volume determination part can be configured to determine data volume of data transmitted by the transmission part. In this step, the instance member in the target socket object in running can be obtained through reflection, and the proxy object of the instance member is constructed. The instance member (which can be identified as impl in an example) is an instance (instance) that actually implements the function of transmitting data of the socket in the socket object, or in other words, transmitting data through the socket object essentially involves calling the instance member of the socket object to transmit data. Reflection is a technology for interacting with classes or objects at runtime. Through reflection, object data and object instances can be obtained dynamically at runtime, such as obtaining data members (variables or properties) and member functions (methods) of an object, including obtaining hidden members of the object. The hidden members of the object usually refer to the members in the object that are not directly exposed to external access. Since the instance member in the target socket object in a production scenario can be a hidden member, it is difficult to access directly when calling the target socket object. Therefore, the hidden member of the target socket object can be obtained through reflection at runtime. In an embodiment, the instance member in the target socket object in running can be obtained through reflection when the target socket object is initialized. The initialization of the object usually refers to the process of allocating memory for the object and setting its initial state or value, which is also the first state of the object in running. In this way, the data volume of data transmitted through the target socket object can be more completely counted. In an embodiment, the target socket object can be a socket object called by a target application.In different embodiments, the target application can be a software application for different specific businesses or purposes, which is not limited in the present specification. The data transmission function of the proxy object can be obtained by combining the data transmission function of the instance member and the data volume statistical code. Specifically, the data transmission function of the instance member can include a data sending function and a data receiving function for data sending and data receiving, respectively. Therefore, in one embodiment, the data transmission function of the instance member can include a first data sending function and a first data receiving function, and the data transmission function of the proxy object can include a second data sending function and a second data receiving function. Further, the second data sending function can include a first transmission part and a first data volume determination part, the first transmission part can transmit data by calling the first data sending function, and the first data volume determination part can be used to determine the data volume of the data transmitted by the first transmission part; the second data receiving function can include a second transmission part and a second data volume determination part, the second transmission part can receive data by calling the first data receiving function, and the second data volume determination part can be used to determine the data volume of the data transmitted by the second transmission part. In one specific embodiment, the data sending function of the proxy object (the second data sending function) can be obtained by combining the calling of the data sending function of the instance member (the first transmission part) and the data volume statistical code (the first data volume determination part); and the data receiving function of the proxy object (the second data receiving function) can be obtained by combining the calling of the data receiving function of the instance member (the second transmission part) and the data volume statistical code (the second data volume determination part). In this way, not only can data be sent and received through the proxy object, but also the data volume sent and received through the proxy object can be completely counted. The data volume determination part can not only determine the total data volume sent or received through the data transmission function, but also determine the data volume sent or received according to the access address or access domain name. Therefore, in one embodiment, the data volume determination part can be used to determine the data volume of the data transmitted by the transmission part according to the access domain name. In another embodiment, it can also be used to determine the data volume of the data transmitted by the transmission part according to the access address. In one specific embodiment, one or more of the total data volume transmitted by the data transmission function of the proxy object, the data volume determined according to the access domain name, and the data volume determined according to the access address can be output, for example, through the return value or output parameter of the data transmission function. In this way, further refined statistical values of the data volume of the application accessing the network can be obtained based on a finer granularity relative to the entire application.For example, not only the total data amount transmitted and / or received by the application can be obtained, but also the data amount transmitted and / or received by the application for different access addresses or different access domain names can be obtained. Then, in step S403, the instance member in the target socket object is replaced by the proxy object, for transmitting data through the data transmission function of the proxy object, and determining the data amount of the transmitted data. In this step, the instance member in the target socket object can be replaced by the proxy object, so that data can be substantially transmitted through the data transmission function of the proxy object, and the transmitted data amount can be determined. In different embodiments, the specific manner in which the instance member in the target socket object is replaced by the proxy object can be different, which is not limited in the present specification. As described above, in the production scenario, the instance member in the target socket object can be a hidden member, which is difficult to directly replace. The instance member can be indirectly replaced by setting other non-hidden members of the target socket object. Specifically, in an embodiment, a factory object for generating the proxy object can be constructed; a global factory member of the socket class for generating the instance member in the socket object is set to the factory object. In this way, the instance member can be replaced by the proxy object in the case where the instance member is a hidden member. In some scenarios, the third-party SDK called in the application also accesses the network through other socket objects. Since in this scenario, the socket object called by the third-party SDK can generate the instance member thereof through the global factory member of the socket class, in an embodiment, the target socket object can be called by the target application, the target application can also call the third-party software development kit, the third-party software development kit can call other socket objects in addition to the target socket object, and the global factory member can also be used to construct the instance member of the other socket object. Through the above manner, in the scenario where the third-party SDK called in the application accesses the network through the socket object, not only the data flow of the application itself accessing the network can be counted, but also the data flow of the third-party SDK called by the application accessing the network can be counted, solving the problem of missing flow statistics caused by the third-party SDK called by the application accessing the network. FIG. 5 shows a schematic block diagram of a data amount determination apparatus according to an embodiment of the present disclosure. The apparatus is used to perform the method shown in FIG. 4.As shown in FIG. 5, the apparatus 500 includes: a proxy unit 501 configured to acquire an instance member in a target socket object in operation by reflection, construct a proxy object corresponding to the instance member, a data transmission function of the proxy object including a transmission part and a data quantity determination part, the transmission part transmitting data by calling a data transmission function of the instance member, and the data quantity determination part being configured to determine a data quantity of data transmitted by the transmission part; and a statistics unit 502 configured to replace the instance member in the target socket object with the proxy object, and transmit data by the data transmission function of the proxy object and determine a data quantity of the transmitted data. The embodiments of the present disclosure also provide an electronic device including a memory and a processor, the memory storing executable code, and the processor implementing the method shown in FIG. 4 when executing the executable code. The following can also refer to FIG. 6, which shows a structure diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. The electronic device 600 shown in FIG. 6 is only an example and should not limit the functions and use range of the embodiments of the present disclosure. As shown in FIG. 6, the electronic device 600 can include a processing device (such as a central processor, a graphics processor, etc.) 601. The processing device 601 described above can be a general-purpose processor, a digital signal processor (Digital Signal Processing, DSP), a microprocessor, or a microcontroller, and can further include an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 602 or programs loaded into a random access memory (RAM) 603 from a storage device 608. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604. Generally, the following devices can be connected to the I / O.Interface 605: Input device 606, including, for example, a touch screen, a touch pad, a keyboard, a mouse, and the like; output device 607, including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage device 608, including, for example, a magnetic tape, a hard disk, and the like; and communication device 609. Communication device 609 can allow electronic device 600 to communicate wirelessly or wired with other devices to exchange data. Although FIG. 6 shows electronic device 600 with various devices, it is understood that not all of the shown devices are required to be implemented or possessed. More or fewer devices can be alternatively implemented or possessed. Each block shown in FIG. 6 can represent a device or multiple devices as needed. In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the method shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through communication device 609, or installed from storage device 608, or installed from ROM 602. When the computer program is executed by processing device 601, the above-mentioned functions defined in the data volume determination method provided by embodiments of the present application are executed. Embodiments of the present disclosure also provide a computer readable storage medium, which stores a computer program, and when the computer program is executed in a computer, the computer executes the data volume determination method shown in FIG. 4 provided by embodiments of the present application. FIG. 7 is a schematic diagram of a storage medium for implementing embodiments of the present application. For example, as shown in FIG. 7, storage medium 700 can be a non-transitory computer readable storage medium for storing non-transitory computer executable instructions 701. oThe data quantity determination method provided in the embodiments of the present application can be implemented when the non-transitory computer executable instructions 701 are executed by the processor. For example, when the non-transitory computer executable instructions 701 are executed by the processor, one or more steps in the data quantity determination method provided in the embodiments of the present application can be performed. For example, the storage medium 700 can be applied to the electronic device described above, for example, the storage medium 700 can include a memory in the electronic device. The description of the storage medium 700 can refer to the description of the memory in the embodiments of the electronic device, and the repeated parts will not be described herein. The specific functions and technical effects of the storage medium 700 can refer to the description of the data quantity determination method provided in the embodiments of the present application, and will not be described herein. It should be noted that the computer readable medium of the embodiments of the present disclosure can be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a memory card of a smart phone, a storage component of a tablet computer, a portable computer disk, a hard disk of a personal computer, a random access memory (RAM), a read only memory (ROM), an erasable programmable read only memory (EPROM or flash memory), an optical fiber, a portable compact disk read only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiments of the present disclosure, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. While in the embodiments of the present disclosure, the computer readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium other than the computer readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained in the computer readable medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, a RF (Radio Frequency, radio frequency), etc., or any suitable combination of the above.The computer readable medium can be included in the electronic device; or can exist independently of the electronic device and can be mounted in the electronic device. The computer readable medium stores one or more programs, and when the one or more programs are executed by the server, the electronic device implements the method for determining data amount provided by the embodiments of the present application. The computer program code for performing the operations of the embodiments of the present application can be written in one or more programming languages or combinations of languages including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). The flow diagrams and block diagrams in the drawings are illustrations of architectures, functions, and operations that can be implemented in systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams and block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or combinations of hardware and software. The units described in the embodiments of the present disclosure can be implemented by means of software, or can be implemented by hardware. In some cases, the name of the unit does not constitute a limitation on the unit itself. The functions described above can be performed at least in part by one or more hardware logic components.For example, and without limitation, example types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc. The various embodiments described in this specification can each be implemented in a computer system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a client computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the subject matter described in this specification, or any combination of these, such as the components of a machine-to-machine (M2M) system. The components of the various embodiments described in this specification can be implemented in a corresponding computer system that includes one or more computers. The components of the computer system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN) and a wide area network (WAN), e.g., the Internet. The embodiments described in this specification can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a client computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the subject matter described in this specification, or any combination of these, such as the components of a machine-to-machine (M2M) system. The components of the computer system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN) and a wide area network (WAN), e.g., the Internet. The embodiments described in this specification can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a client computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the subject matter described in this specification, or any combination of these, such as the components of a machine-to-machine (M2M) system. The components of the computer system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN) and a wide area network (WAN), e.g., the Internet.

Claims

CLAIM 1. A method of determining a data volume, comprising: The instance member in the target socket object in operation is acquired through reflection, a proxy object corresponding to the instance member is constructed, a data transmission function of the proxy object comprises a transmission part and a data amount determination part, the transmission part transmits data by calling a data transmission function of the instance member, and the data amount determination part is used for determining a data amount of data transmitted by the transmission part.

2. The method of claim 1, wherein, The proxy object corresponding to the instance member is constructed, comprising: based on a decorator mode, the proxy object corresponding to the instance member is constructed.

3. The method according to claim 1, wherein, The data transmission function of the instance member comprises a first data sending function and a first data receiving function, the data transmission function of the proxy object comprises a second data sending function and a second data receiving function, the data transmission function of the proxy object comprises a transmission part and a data amount determination part, the transmission part transmits data by calling the data transmission function of the instance member, and the data amount determination part is used for determining a data amount of data transmitted by the transmission part, comprising: the second data sending function comprises a first transmission part and a first data amount determination part, the first transmission part transmits data by calling the first data sending function, and the first data amount determination part is used for determining a data amount of data transmitted by the first transmission part; the second data receiving function comprises a second transmission part and a second data amount determination part, the second transmission part receives data by calling the first data receiving function, and the second data amount determination part is used for determining a data amount of data transmitted by the second transmission part.

4. The method according to claim 1, wherein, The data amount of data transmitted by the transmission part comprises: a data amount of data transmitted by the transmission part and determined according to an access domain name.

5. The method according to claim 1, wherein, The data amount of data transmitted by the transmission part comprises: a data amount of data transmitted by the transmission part and determined according to an access address.

6. The method of claim 1, wherein, The instance member in the socket object is replaced by the proxy object, comprising: a factory object for generating the proxy object is constructed; a global factory member of a socket class is set as the factory object, the global factory member is used for generating the instance member in the socket object. The instance member in the target socket object in operation is acquired through reflection, comprising: in response to initialization of a target socket object, the instance member in the target socket object is acquired through reflection.

7. The method according to claim 1, wherein, ​ 8. An apparatus for determining a data volume, comprising: The agent unit is configured to obtain an instance member in a target socket object in operation by reflection, construct an agent object corresponding to the instance member, and the data transmission function of the agent object includes a transmission part and a data amount determination part, the transmission part transmits data by calling the data transmission function of the instance member, and the data amount determination part is used to determine the data amount of the data transmitted by the transmission part. The statistical unit is configured to replace the instance member in the target socket object with the agent object, and is used to transmit data by the data transmission function of the agent object and determine the data amount of the transmitted data.

9. A computer-readable storage medium having stored thereon a computer program, which, when executed by a computer, causes the computer to carry out the method of any one of claims 1-7.

10. An electronic device, comprising a memory and a processor, the memory storing executable code, and the processor implementing the method of any one of claims 1-7 when executing the executable code.

11. A computer program product tangibly stored on a computer storage medium and comprising computer-executable instructions that, when executed by a device, cause the device to perform the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Intranet host and in-cloud drainage method and device

    CN112019554A

  • Fuzzy test method and device for network traffic, storage medium and processor

    CN113271235A

  • Traffic monitoring method and device, storage medium and electronic equipment

    CN113556260A