Core Library Proxy Injection for Socket Delegation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current socket delegation methods require injecting custom code at multiple places, affecting the stability and performance of application programs due to excessive content injection.
Innovation Solution
A method involving a first core library that injects a proxy connect function into a second core library for centralized management of socket invocations, allowing a custom connect function to be injected based on a preset injection method, enabling delegation of sockets without direct invocation of the preset connect function.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If custom code is injected at every place where sockets are invoked, then socket delegation can be achieved, but the stability and performance of the application program deteriorates due to excessive content injection
Solution Approach 1:
The patent merges multiple socket delegation injection points into a single centralized injection location. Instead of injecting custom code at every socket invocation point, the system creates a unified injection mechanism in a core library that handles all socket delegation requests centrally, thereby reducing the total amount of injected content while maintaining delegation functionality
Solution Approach 2:
The patent implements a universal injection mechanism that serves multiple socket delegation purposes through a single interface. The core library provides a general-purpose injection function that can handle various socket scenarios (TCP, UDP, etc.) without requiring separate custom code for each case, thus improving stability while maintaining versatility
2Adaptability or versatility
If custom code is injected at every place where sockets are invoked, then socket delegation can be achieved, but the performance of the application program deteriorates due to excessive content injection
Solution Approach 1:
The patent combines multiple injection operations into a single centralized injection point in the core library. This reduces the overhead of multiple injection operations and minimizes the impact on application performance while still achieving comprehensive socket delegation across all invocation points
3Adaptability or versatility
If multiple custom codes are injected to manage socket invocations, then delegation functionality is achieved, but the complexity of code injection increases
Solution Approach 1:
The patent merges multiple code injection operations into a single unified injection mechanism. By establishing a centralized injection point in the core library, the system reduces the complexity of managing multiple injection locations and simplifies the overall code injection process while maintaining full delegation functionality
Solution Approach 2:
The patent creates a universal injection interface that handles various socket delegation scenarios through a single function. This multi-functional approach eliminates the need for separate injection code for different socket types and scenarios, thereby reducing code injection complexity while maintaining comprehensive delegation capability
Data Source
AI summary
Embodiments of the present disclosure provide a method, apparatus, device and storage medium for function processing. The method comprises: loading a first core library in a preset application program, wherein the first core library injects a proxy connect function in the first core library to a second core library to perform centralized management of the invoking of a preset socket, the second core library including a preset connect function, the preset connect function being used to establish a connection with the preset socket; injecting a custom connect function to the second core library based on a preset injection method corresponding to the proxy connect function; in accordance with a determination that the preset application program invokes the preset connect function via the second core library, invoking the custom connect function instead to implement a custom logic so as to delegate the preset socket. With the above technical solution, the injection of codes for delegating socket can be reduced, and the stability and performance of the application program can be guaranteed.


