Data volume determination method and device, equipment 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 in the existing technology is solved, and more refined data traffic statistics are achieved.

CN120880932APending Publication Date: 2025-10-31FACE CUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410543761.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-30
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

Existing socket-based communication schemes cannot obtain the amount of data transmitted through the socket when the socket is invoked.

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 with the proxy object to achieve data transfer and data volume determination.

Benefits of technology

It enables the acquisition of the amount of data transmitted by the socket when calling the socket, solves the problem of missing traffic statistics, and can perform fine-grained statistics on the data traffic of different access domains or addresses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120880932A_ABST
    Figure CN120880932A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data volume determination method and device, equipment and a medium. A specific implementation mode of the method comprises the steps that instance members in a target socket object in operation are obtained through reflection, proxy objects corresponding to the instance members are constructed, a data transmission function of the proxy objects comprises a transmission part and a data volume determination part, the transmission part transmits data by calling the data transmission functions of the instance members, and the data volume determination part determines the data volume of the target socket object. The data volume determination part is 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 a proxy object for transmitting data through a data transmission function of the proxy object, and determining the data volume of the transmitted data. Through the method, the data volume transmitted through the socket can be obtained through the socket.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of network access technology, and in particular to a method, apparatus, device, and medium for determining data volume. Background Technology

[0002] Existing socket-based communication schemes cannot obtain the amount of data transmitted through the socket when the socket is invoked. Summary of the Invention

[0003] This disclosure describes a method, apparatus, device, and medium for determining the amount of data.

[0004] According to the first aspect, a method for determining the amount of data is provided, including:

[0005] The instance members of the running target socket object are obtained by reflection, and a proxy object corresponding to the instance member is constructed. The data transmission function of the proxy object includes a transmission part and a data volume determination part. The transmission part transmits data by calling the data transmission function of the instance member, and the data volume determination part is used to determine the amount of data transmitted by the transmission part.

[0006] The instance members in the target socket object are replaced with the proxy object, which is used to transmit data through the data transmission functions of the proxy object and to determine the amount of data transmitted.

[0007] According to the second aspect, a data traffic statistics device is provided, comprising:

[0008] The proxy unit is configured to obtain instance members in a running target socket object through reflection, construct a proxy object corresponding to the instance members, and the data transmission function of the proxy object includes a transmission part and a data volume determination part. The transmission part transmits data by calling the data transmission function of the instance members, and the data volume determination part is used to determine the data volume of the data transmitted by the transmission part.

[0009] The statistics unit is configured to replace the instance members in the target socket object with the proxy object, and to transmit data through the data transmission function of the proxy object and determine the amount of data transmitted.

[0010] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed in a computer, causes the computer to perform the method of the first aspect.

[0011] According to a fourth aspect, an electronic device is provided, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method of the first aspect.

[0012] This disclosure provides a method, apparatus, device, and medium for determining data volume. First, instance members of a running target socket object are obtained via reflection. A proxy object corresponding to each instance member is constructed. The proxy object's data transmission function includes a transmission part and a data volume determination part. The transmission part transmits data by calling the instance member's data transmission function, and the data volume determination part is used to calculate the amount of data transmitted by the transmission part. Then, the instance members in the target socket object are replaced with the proxy object, which is used to transmit data through the proxy object's data transmission function and to confirm the amount of data transmitted. This method allows the amount of data transmitted through the socket to be obtained when the socket is invoked. Attached Figure Description

[0013] Figure 1 A schematic diagram of an application traffic statistics scheme is shown;

[0014] Figure 2 A schematic diagram of another application traffic statistics scheme is shown;

[0015] Figure 3 A schematic diagram of a method for determining the amount of data according to an embodiment of the present disclosure is shown;

[0016] Figure 4 A flowchart illustrating a method for determining data volume according to an embodiment of the present disclosure is shown;

[0017] Figure 5 A schematic block diagram of a data volume determination device according to an embodiment of the present disclosure is shown;

[0018] Figure 6 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is provided;

[0019] Figure 7 A schematic diagram of the structure of a storage medium suitable for implementing embodiments of the present disclosure is provided. Detailed Implementation

[0020] The technical solutions provided in this specification will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not intended to limit the invention. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0021] In the description of the implementations disclosed herein, the term "comprising" and similar terms should be understood as open inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one / an implementation" or "the implementation" should be understood as "at least one / an implementation". The term "some implementations" should be understood as "at least some implementations". Other explicit and implicit definitions may also be included below.

[0022] In many application runtime scenarios, it is desirable to obtain the amount of data sent or received by the application over the network during application runtime (or application data traffic, or simply application traffic). Existing solutions for measuring application data traffic typically obtain the amount of data sent or received by the application during runtime through interfaces provided by, for example, the network layer of the terminal system. Figure 1 A schematic diagram of an application traffic statistics scheme is shown. For example... Figure 1 In the example shown, the application can obtain the amount of data sent or received during runtime by calling an interface provided by the network layer of the local terminal system. However, this approach has the following problem: it can only obtain a statistical value of the total amount of data sent or received by the entire application.

[0023] Another approach to application traffic statistics involves obtaining the amount of data sent or received through a specific network request framework when an application calls that framework for network data transmission. Figure 2 This diagram illustrates another application of traffic statistics. (For example...) Figure 2 As shown, when an application calls a specific network framework, the amount of data received and sent by the application over the network can be counted above the network application layer through that specific network request framework. However, this approach typically only calculates the amount of data sent or received by the application's own code. Therefore, it often suffers from omissions in traffic statistics.

[0024] To address the aforementioned technical problems, this disclosure provides a method for determining the amount of data. A socket is an abstract component representing a communication endpoint for bidirectional communication between applications on different hosts in a network. By invoking a socket, software applications above the application layer can exchange data using network protocols. Existing software applications typically communicate with each other via sockets; even the aforementioned network request frameworks or third-party SDKs usually send and receive network data by invoking sockets. However, the functions (or methods) included in existing sockets for sending or receiving data can typically only perform the operation of sending or receiving data, and cannot count the amount of data sent or received through the socket. Figure 3 A schematic diagram of a method for determining data volume according to an embodiment of the present disclosure is shown. Figure 3 In the example shown, instance members of the currently running socket object can be obtained through reflection, and then proxy objects corresponding to these instance members can be constructed. The send and receive functions of the proxy object can be built based on the send and receive functions of the instance members, along with data volume statistics code. This allows the send and receive functions of the proxy object to not only send or receive data but also to count the amount of data sent or received through them. Then, the proxy object (or proxy member) can replace the instance members in the socket object, allowing the data transmitted (including sent and received) through the socket object to be directly counted. In some embodiments, the data volume statistics code can also be used to determine the application's data traffic for different access domains, or the application's data traffic for different access addresses.

[0025] The advantages of this method are twofold: First, compared to traditional methods that use specific network request frameworks to count application traffic, it can count not only the network traffic accessed by the application's own code but also the network traffic accessed by third-party SDKs called by the application, thus solving the problem of missing traffic statistics. Second, compared to traditional methods that count application traffic through network layer interfaces, it can obtain more granular statistical values ​​of data traffic, such as statistical values ​​of data traffic accessed by different domain names or different access addresses.

[0026] The following describes the detailed process of this method.

[0027] Figure 4 A flowchart illustrating a method for determining data volume according to an embodiment of this disclosure is shown. Figure 4 As shown, the method includes at least the following steps:

[0028] Step S401: Obtain instance members in the running target socket object through reflection, construct a proxy object corresponding to the instance member, the data transmission function of the proxy object includes a transmission part and a data volume determination part, the transmission part transmits data by calling the data transmission function of the instance member, and the data volume determination part is used to determine the data volume of the data transmitted by the transmission part;

[0029] Step S403: Replace the instance members in the target socket object with the proxy object, which is used to transmit data through the data transmission function of the proxy object and to determine the amount of data transmitted.

[0030] First, in step S401, instance members of the running target socket object are obtained through reflection, and proxy objects corresponding to the instance members are constructed. The data transfer function of the proxy object can include a transmission part and a data volume determination part. The transmission part can transmit data by calling the data transfer function of the instance member, and the data volume determination part can be used to count the amount of data transmitted by the transmission part. In this step, instance members of the running target socket object can be obtained through reflection, and proxy objects of the instance members are constructed. An instance member (in one example, it can be identified as impl) is an instance in the socket object that actually implements the socket's data transmission function. In other words, transmitting data through a socket object is essentially calling the instance members of the socket object to transmit data. Reflection is a technique for interacting with classes or objects at runtime. Through reflection, object data and object instances can be dynamically obtained at runtime, such as obtaining the object's data members (variables or properties) and member functions (methods), including obtaining the object's hidden members. Hidden members of an object typically refer to members of the object that are not directly exposed to external access. In production environments, instance members of the target socket object can be hidden, making them difficult to access directly when calling the target socket object. Therefore, hidden members of the target socket object can be obtained at runtime using reflection.

[0031] In one implementation example, instance members of the running target socket object can be obtained via reflection during the target socket object's initialization. Initialization, or object initialization, typically refers to the process of allocating memory for the object and setting its initial state or values; it is also the first state of the object's operation. This method allows for a more complete statistical analysis of the amount of data transmitted through the target socket object. In one embodiment, the target socket object can be a socket object invoked by the target application. In different specific embodiments, the target application can be a software application for different specific business or purposes, and this specification does not impose any limitations on this.

[0032] The data transfer function of the proxy object can be obtained by combining the data transfer functions of the instance members and the data volume statistics code. Specifically, the data transfer function of the socket member instance can include a data sending function and a data receiving function, used for data sending and data receiving, respectively. Therefore, in one embodiment, the data transfer function of the instance member can include a first data sending function and a first data receiving function, and the data transfer function of the proxy object can include a second data sending function and a second data receiving function. Furthermore, 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 a specific embodiment, the data sending function (second data sending function) of the proxy object can be obtained by combining the data sending function of the instance member (first transmission part) and the data volume statistics code (first data volume determination part); and the data receiving function (second data sending function) of the proxy object can be obtained by combining the data receiving function of the instance member (second transmission part) and the data volume statistics code (second data volume determination part). Through this method, not only can data be sent and received through the proxy object, but the amount of data sent and received through the proxy object can also be fully counted.

[0033] The data volume determination section can determine not only the total amount of data sent or received through the data transmission function, but also the amount of data sent or received based on the access address or access domain name. Therefore, in one embodiment, the data volume determination section can be used to determine the amount of data transmitted through the transmission section based on the access domain name. In another embodiment, it can also be used to determine the amount of data transmitted through the transmission section based on the access address. In a specific embodiment, one or more of the determined amounts of total data transmitted through the proxy object's data transmission function, data based on the access domain name, and data based on the access address can be output, for example, through the return value or output parameter of the data transmission function. This allows for more refined statistical values ​​of the application's network access data traffic at a finer granularity relative to the entire application. For example, not only can statistical values ​​of the total amount of data sent and / or received by the application be obtained, but also statistical values ​​of the amount of data sent and / or received by the application for different access addresses or different access domain names can be obtained.

[0034] Then, in step S403, the instance members in the target socket object are replaced with the proxy object, which is used to transmit data through the data transmission functions of the proxy object and to determine the amount of data transmitted. In this step, the instance members in the target socket object can be replaced with the proxy object, thus substantially allowing data to be transmitted through the data transmission functions of the proxy object, and the amount of data transmitted can be statistically analyzed. In different embodiments, the specific method of replacing the instance members in the target socket object with the proxy object may differ, and this specification does not limit this.

[0035] As mentioned earlier, in production scenarios, instance members in the target socket object can be hidden members, making them difficult to replace directly. Instance members can be indirectly replaced by setting other, non-hidden members of the target socket object. Specifically, in one embodiment, a factory object can be constructed to generate the proxy object; a global factory member of the socket class is set to this factory object, and this global factory member is used to generate instance members in the socket object. In this way, even when the instance member is hidden, it can be replaced with a proxy object.

[0036] In some scenarios, third-party SDKs called by applications also access the network through other socket objects. Since the socket objects called by the third-party SDK in such scenarios can typically generate instance members through the global project members of the socket class, in one embodiment, the target socket object can be called by the target application. The target application can also call a third-party software development kit (SDK), which can call other socket objects besides the target socket object. The global factory member can also be used to construct instance members of these other socket objects. Through this method, in scenarios where third-party SDKs called by applications access the network through socket objects, not only the data traffic accessed by the application itself but also the data traffic accessed by the third-party SDKs called by the application can be statistically analyzed, solving the problem of missing traffic statistics usually caused by third-party SDKs called by applications accessing the network.

[0037] Figure 5 A schematic block diagram of a data volume determination apparatus according to an embodiment of the present disclosure is shown. The apparatus is used to perform, for example... Figure 4 The method shown. (As shown) Figure 5 As shown, the device 500 includes:

[0038] The proxy unit 501 is configured to obtain instance members in a running target socket object through reflection, construct a proxy object corresponding to the instance members, and the data transmission function of the proxy object includes a transmission part and a data volume determination part. The transmission part transmits data by calling the data transmission function of the instance members, and the data volume determination part is used to determine the data volume of the data transmitted by the transmission part.

[0039] The statistics unit 502 is configured to replace the instance members in the target socket object with the proxy object, for transmitting data through the data transmission function of the proxy object and determining the amount of data transmitted.

[0040] This disclosure also provides an electronic device, including a memory and a processor. The memory stores executable code, and when the processor executes the executable code, it implements, for example... Figure 4 The method shown.

[0041] The following can also be referenced Figure 6 It shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiments of this application. Figure 6 The electronic device 600 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0042] like Figure 6 As shown, electronic device 600 may include a processing device (e.g., central processing unit, graphics processor, etc.) 601. The aforementioned processing device 601 may be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and may further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0043] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 6 Each box shown can represent a device or multiple devices as needed.

[0044] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the data volume determination method provided in embodiments of this application.

[0045] This disclosure also provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed in a computer, it causes the computer to perform the functions provided in the embodiments of this application. Figure 4 The method for determining the amount of data shown. Figure 7 This is a schematic diagram illustrating a storage medium for implementing an embodiment of this application. For example, such as... Figure 7As shown, the storage medium 700 can be a non-transitory computer-readable storage medium used to store non-transitory computer-executable instructions 701. When the non-transitory computer-executable instructions 701 are executed by a processor, the data quantity determination method provided in the embodiments of this application can be implemented. For example, when the non-transitory computer-executable instructions 701 are executed by a processor, one or more steps in the data quantity determination method provided in the embodiments of this application can be performed. For example, the storage medium 700 can be applied in the above-mentioned electronic device. For example, the storage medium 700 can include the memory in the electronic device. For a description of the storage medium 700, please refer to the description of the memory in the embodiments of the electronic device; repeated descriptions will not be repeated here. The specific functions and technical effects of the storage medium 700 can be referred to the description of the data quantity determination method provided in the embodiments of this application; repeated descriptions will not be repeated here.

[0046] It should be noted that the computer-readable medium in the embodiments of this disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a memory card of a smartphone, a storage component of a tablet computer, a portable computer disk, a hard disk of a personal computer, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the embodiments of this disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the embodiments of this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein computer-readable program code is carried. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0047] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs, which, when executed by the server, cause the electronic device to implement the data volume determination method provided in the embodiments of this application.

[0048] Computer program code for performing the operations of embodiments of this disclosure can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages—such as Java, Small Language, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0049] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. The units described in the embodiments of the present disclosure may be implemented in software or hardware. The names of the units do not necessarily constitute a limitation on the unit itself. The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application-Specific Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0050] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for storage media and computing devices are basically similar to the method embodiments, so they are described more simply; relevant parts can be referred to the descriptions of the method embodiments.

[0051] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in this disclosure. Furthermore, although the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of a single embodiment may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0052] The above detailed embodiments further illustrate the purpose, technical solution, and beneficial effects of the embodiments of the present invention. Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solutions of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for determining data volume, comprising: The instance members of the running target socket object are obtained by reflection, and a proxy object corresponding to the instance member is constructed. The data transmission function of the proxy object includes a transmission part and a data volume determination part. The transmission part transmits data by calling the data transmission function of the instance member, and the data volume determination part is used to determine the amount of data transmitted by the transmission part. The instance members in the target socket object are replaced with the proxy object, which is used to transmit data through the data transmission functions of the proxy object and to determine the amount of data transmitted.

2. The method according to claim 1, wherein, Constructing the proxy object corresponding to the instance member includes: Based on the decorator pattern, construct proxy objects corresponding to the instance members.

3. The method according to claim 1, wherein, The data transmission functions of the instance members include a first data sending function and a first data receiving function, and the data transmission functions of the proxy object include a second data sending function and a second data receiving function; The data transmission function of the proxy object includes a transmission part and a data volume determination part. The transmission part transmits data by calling the data transmission function of the instance member. The data volume determination part is used to determine the data volume of the data transmitted by the transmission part, including: a second data sending function including a first transmission part and a first data volume determination part, the first transmission part transmitting data by calling the first data sending function, and the first data volume determination part being used to determine the data volume of the data transmitted by the first transmission part; a second data receiving function including a second transmission part and a second data volume determination part, the second transmission part receiving data by calling the first data receiving function, and the second data volume determination part being used to determine the data volume of the data transmitted by the second transmission part.

4. The method according to claim 1, wherein, The amount of data transmitted by the transmission section includes: The amount of data transmitted through the transmission section, determined by the access domain name.

5. The method according to claim 1, wherein, The amount of data transmitted through the transmission section includes: The amount of data transmitted through the transmission section, determined based on the access address.

6. The method according to claim 1, wherein, Replacing the instance members in the socket object with the proxy object includes: Construct a factory object for generating the proxy object; Set the global factory member of the socket class to the factory object, and the global factory member is used to generate instance members in the socket object.

7. The method according to claim 1, wherein, Retrieving instance members from a running target socket object via reflection includes: retrieving instance members from the target socket object via reflection in response to the initialization of the target socket object.

8. A device for determining the amount of data, comprising: The proxy unit is configured to obtain instance members in a running target socket object through reflection, construct a proxy object corresponding to the instance members, and the data transmission function of the proxy object includes a transmission part and a data volume determination part. The transmission part transmits data by calling the data transmission function of the instance members, and the data volume determination part is used to determine the data volume of the data transmitted by the transmission part. The statistics unit is configured to replace the instance members in the target socket object with the proxy object, and is used to transmit data through the data transmission function of the proxy object and determine the amount of data transmitted.

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

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