Service requesting method and terminal equipment

By dynamically selecting the transmission protocol and link between the terminal device and multiple candidate gateways, the service request failure caused by network instability is solved, and the success rate and stability of the service request are improved.

CN120343096APending Publication Date: 2025-07-18ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510530566.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the prior art, the instability of network connections leads to a low success rate of service requests, affecting the user experience.

Method used

The terminal device dynamically selects the first target gateway through communication link information with multiple candidate gateways and sends service requests based on its transmission protocol to realize diversified transmission protocols and link information filtering.

Benefits of technology

It improves the success rate of service requests, avoids request interruptions caused by network fluctuations and protocol blockade, and ensures the continuity and stability of services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120343096A_ABST
    Figure CN120343096A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a service requesting method and terminal equipment. In the method, the terminal equipment generates a service request in response to a detected target operation triggered by a user. And then, the terminal equipment determines a first target gateway in a plurality of candidate gateways based on link information of communication links between the terminal equipment and the plurality of candidate gateways, and the plurality of candidate gateways correspond to different transmission protocols. And furthermore, the terminal equipment sends the service request to the first target gateway based on a transmission protocol corresponding to the first target gateway, so that the first target gateway sends the service request to a server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of Internet technologies, and in particular, to a method for requesting services and a terminal device. Background Art

[0002] With the wide application of Internet technologies, the stability of network connections has become a key factor affecting the reliability of online services. In practical applications, when network congestion occurs, the server is overloaded, the network is unstable, or even blocked by the operator, service requests may fail or be delayed, resulting in a decrease in the success rate of service requests and seriously affecting the user experience.

[0003] Therefore, how to improve the success rate of service requests is an urgent problem to be solved in the prior art.

[0004] The content in the background art section is only the information known to the inventor personally, and does not represent that the above information has entered the public domain before the filing date of the present disclosure, nor does it represent that it can become the prior art of the present disclosure. Summary of the Invention

[0005] This specification provides a method for requesting services and a terminal device, which can improve the success rate of service requests.

[0006] In a first aspect, this specification provides a method for requesting services, which is applied to a terminal device and includes: generating a service request in response to detecting a target operation triggered by a user; determining a first target gateway among a plurality of candidate gateways based on link information of communication links between the terminal device and the plurality of candidate gateways, where the plurality of candidate gateways correspond to different transmission protocols; and sending the service request to the first target gateway based on the transmission protocol corresponding to the first target gateway, so that the first target gateway sends the service request to a server.

[0007] In some embodiments, the link information includes: link status information and link performance information. Determining the first target gateway among the plurality of candidate gateways based on the link information of the communication links between the terminal device and the plurality of candidate gateways includes: determining at least one available gateway among the plurality of candidate gateways based on the link status information of the communication links between the terminal device and the plurality of candidate gateways, where the link status of the communication link between the terminal device and the available gateway is a passage; and determining the first target gateway among the at least one available gateway based on the link performance information of the communication links between the terminal device and the at least one available gateway.

[0008] In some embodiments, the link status information includes one of a passage or a break, and the link status information is obtained by the terminal device through heartbeat detection of the communication link.

[0009] In some embodiments, the link performance information includes: transmission response duration and transmission success rate. Determining the first target gateway from the at least one available gateway based on the link performance information of the communication link between the terminal device and the at least one available gateway includes: for each available gateway, determining a first performance score based on the transmission response duration of the communication link between the terminal device and the available gateway, determining a second performance score based on the transmission success rate of the communication link between the terminal device and the available gateway, and determining a comprehensive performance score based on the first performance score and the second performance score; and determining the available gateway with the highest comprehensive performance score among the at least one available gateway as the first target gateway.

[0010] In some embodiments, the transmission response duration is obtained by the terminal device probing the communication link, and the transmission success rate is obtained by the terminal device based on the historical transmission data of the communication link.

[0011] In some embodiments, the link performance information includes performance information in multiple dimensions. Determining the first target gateway from the at least one available gateway based on the link performance information of the communication link between the terminal device and the at least one available gateway includes: determining the service type requested by the service request, and determining the weight information corresponding to the multiple dimensions based on the service type; for each available gateway, determining the comprehensive performance score corresponding to the available gateway based on the performance information in the multiple dimensions and the weight information corresponding to the multiple dimensions; and determining the available gateway with the highest comprehensive performance score among the at least one available gateway as the first target gateway.

[0012] In some embodiments, after sending the service request to the first target gateway, the method further includes: receiving a service result from the first target gateway, where the service result is the result obtained by the server based on the service request.

[0013] In some embodiments, if the service result is not received from the first target gateway within a preset time, the method further includes: determining a second target gateway from other gateways among the multiple candidate gateways except the first target gateway; sending the service request to the second target gateway based on the transmission protocol corresponding to the second target gateway, so that the second target gateway sends the service request to the server; and receiving a service result from the second target gateway.

[0014] In some embodiments, determining a second target gateway from among the other gateways in the multiple candidate gateways except the first target gateway includes: when the number of the other gateways is greater than 1, determining the second target gateway from among the other gateways based on the link information of the communication links between the terminal device and each of the other gateways.

[0015] In some embodiments, the method further includes: for each candidate gateway, sending a probe request to the candidate gateway at a preset interval to determine the link state information of the communication link between the terminal device and the candidate gateway; and when the number of times that the probe response corresponding to the probe request is not received exceeds a preset threshold, disconnecting and re-creating the communication link between the terminal device and the candidate gateway.

[0016] In some embodiments, the multiple candidate gateways include at least two of the following: a gateway corresponding to the TCP protocol, a gateway corresponding to the UDP protocol, a gateway corresponding to the SCTP protocol, and a gateway corresponding to the DCCP protocol.

[0017] In some embodiments, the multiple candidate gateways include a first candidate gateway and a second candidate gateway, the first candidate gateway corresponds to the TCP protocol, the second candidate gateway corresponds to the UDP protocol, wherein the communication link between the terminal device and the first candidate gateway is a link created before the target operation is detected, and the method further includes: in response to detecting the target operation, creating a communication link between the terminal device and the second candidate gateway; and in response to receiving the service result, disconnecting the communication link between the terminal device and the second candidate gateway.

[0018] In some embodiments, the target operation is an operation of initiating a payment, the service request is a payment request, and the service result is a payment result.

[0019] In a second aspect, this specification also provides a terminal device, including at least one storage medium and at least one processor. The at least one storage medium stores at least one instruction set for requesting a service. The at least one processor is communicatively connected to the at least one storage medium. Wherein, when the at least one processor runs, it reads the at least one instruction set and executes the method according to any one of the above-mentioned first aspects based on the indication of the at least one instruction set.

[0020] As can be seen from the above technical solutions, for the method and terminal device for requesting services provided in this specification, after the terminal device generates a service request based on a target operation triggered by a user, it can dynamically determine a first target gateway based on the link information of the communication links between the terminal device and multiple candidate gateways, and send the service request to the server based on the transport protocol corresponding to the first target gateway. In the above method, through the mechanism of parallel candidate selection of multiple candidate gateways and the diversity of transport protocols (multiple candidate gateways correspond to different transport protocols), it is achieved that even during network fluctuations, the terminal device can determine the first target gateway among multiple candidate gateways based on the link information of multiple candidate links, overcoming the stability defect of the communication link caused by single-connection dependence and avoiding request interruption caused by protocol blocking or link congestion. In addition, since the communication link information of multiple candidate gateways is not static, compared with the method of screening the first target gateway based on fixed rules, the terminal device in this application screens the first target gateway based on dynamic link information, enabling the terminal device to make a suitable selection among multiple candidate gateways based on the current actual situation, and the screened first target gateway can effectively match the transport protocol characteristics of the current network environment, improving the success rate of service requests.

[0021] Other functions of the method and terminal device for requesting services provided in this specification will be partially listed in the following description. The creative aspects of the method and terminal device for requesting services provided in this specification can be fully explained through practice or the use of the methods, devices, and combinations described in the detailed examples below. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] To more clearly illustrate the technical solutions in the embodiments of this specification, the following will briefly introduce the drawings required for describing the embodiments. Obviously, the drawings in the following description are only some embodiments of this specification, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.

[0023] Figure 1 FIG. shows a schematic diagram of an application scenario provided according to an embodiment of this specification;

[0024] Figure 2 FIG. shows a schematic diagram of the hardware structure of a computing device provided according to some embodiments of this specification;

[0025] Figure 3 FIG. shows a schematic flowchart of a method for requesting services provided according to an embodiment of this specification; and

[0026] Figure 4 FIG. shows a schematic flowchart of a method for requesting services provided according to another embodiment of this specification. Detailed Implementation Modes

[0027] The following description provides specific application scenarios and requirements of this specification, aiming to enable those skilled in the art to manufacture and use the content in this specification. For those skilled in the art, various partial modifications to the disclosed embodiments are obvious, and without departing from the spirit and scope of this specification, the general principles defined here can be applied to other embodiments and applications. Therefore, this specification is not limited to the illustrated embodiments, but has the broadest scope consistent with the claims.

[0028] The terms used herein are for the purpose of describing specific example embodiments only and are not restrictive. For example, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" used herein may also include the plural forms. When used in this specification, the terms "comprising", "including", and / or "containing" mean that the associated integers, steps, operations, elements, and / or components exist, but do not exclude the existence of one or more other features, integers, steps, operations, elements, components, and / or groups, or the addition of other features, integers, steps, operations, elements, components, and / or groups in the system / method.

[0029] Considering the following description, these features of this specification and other features, as well as the operations and functions of the related elements of the structure, and the economy of the combination and manufacture of the components can be significantly improved. Referring to the accompanying drawings, all of these form a part of this specification. However, it should be clearly understood that the drawings are for illustrative and descriptive purposes only and are not intended to limit the scope of this specification. It should also be understood that the drawings are not drawn to scale.

[0030] The flowcharts used in this specification illustrate the operations implemented by the system according to some embodiments in this specification. It should be clearly understood that the operations in the flowchart may not be implemented in sequence. On the contrary, the operations may be implemented in reverse order or simultaneously. In addition, one or more other operations may be added to the flowchart. One or more operations may be removed from the flowchart.

[0031] In this specification, the meaning of "X includes at least one of A, B, or C" is that X includes at least A, or X includes at least B, or X includes at least C. That is to say, X may only include any one of A, B, C, or simultaneously include any combination of A, B, C and other possible content / elements. Any combination of A, B, C may be A, B, C, AB, AC, BC, or ABC.

[0032] In this specification, unless otherwise specified, the association relationships generated between structures can be either direct or indirect. For example, when describing "A is connected to B", unless it is clearly stated that A is directly connected to B, it should be understood that A can be directly connected to B or indirectly connected to B; for another example, when describing "A is above B", unless it is clearly stated that A is directly above B (A and B are adjacent and A is above B), it should be understood that A can be directly above B or indirectly above B (there are other elements between A and B and A is above B). And so on.

[0033] It should be noted that the user data obtained in this specification has been authorized by the user and does not involve user privacy.

[0034] For the convenience of description, the terms that will appear in the following text of this specification are first explained.

[0035] Round-Trip Time (RTT): RTT refers to the time required to send a data packet and receive the response of that data packet. It reflects the network latency. If the RTT value is high, it means that the network transmission speed is slow and there may be problems.

[0036] Domain Name: Also known as a network domain, it is the name of a computer or a group of computers on the Internet composed of a string of names separated by dots, used to identify the location of a computer during data transmission (sometimes also referring to a geographical location).

[0037] Transmission Control Protocol (TCP): TCP is a connection-oriented and reliable transport layer protocol. It provides a full-duplex byte stream service to ensure that data packets arrive in order and without errors. TCP establishes a connection through a three-way handshake and disconnects through a four-way handshake. It also provides functions such as flow control, congestion control, and error detection. It has the characteristics of reliability, orderliness, flow control, congestion control, etc. It is suitable for applications that require high reliability, such as web browsing, file transfer (FTP), email (SMTP), etc.

[0038] User Datagram Protocol (UDP): UDP is a connectionless and unreliable transport layer protocol. It does not provide mechanisms for packet acknowledgment, sequencing, or retransmission. Therefore, the data transmission speed is relatively fast but the reliability is relatively low. UDP is suitable for applications with high real-time requirements but low requirements for data integrity.

[0039] Stream Control Transmission Protocol (SCTP): It supports multi-stream transmission, enables different types of data to be independently transmitted in one connection, provides a reliable transmission mechanism to ensure the accurate arrival of data, and also has a congestion control function to adjust the transmission rate according to network conditions, so as to optimize network resource utilization and improve communication performance.

[0040] Datagram Congestion Control Protocol (DCCP): It is used in an unreliable network environment to provide a data transmission method that can adapt to network congestion conditions, so as to avoid problems such as data loss and increased latency caused by network congestion, and at the same time maintain some characteristics of UDP, such as low latency and connectionless, and is suitable for applications with high real-time requirements, such as video streams and audio streams.

[0041] In the interaction scenario between a terminal device and a server, the terminal device and the server usually rely on a single communication link for data transmission. However, due to problems such as network congestion, server overload, failure of load balancing strategies, network protocol blocking, QoS fluctuations of service providers, client configuration errors, and dynamic recycling of network resources, the network connection between the terminal device and the server may become unstable (network connection disconnection, increased latency, unstable bandwidth, connection failure, etc.). As a result, the service requests submitted by users cannot be normally executed, or there are problems such as latency, and the success rate of service requests is relatively low, seriously affecting the user experience.

[0042] Therefore, this specification provides a method for requesting services to improve the success rate of service requests. Specifically, multiple candidate gateways are deployed between the terminal device and the server, and the multiple candidate gateways correspond to different transmission protocols. When the terminal device needs to send a service request, the terminal device can determine a first target gateway among the multiple candidate gateways based on the link information of the communication links between the terminal device and the multiple candidate gateways. Furthermore, the terminal device sends the service request to the first target gateway based on the transmission protocol corresponding to the first gateway, so that the first target gateway sends the service request to the server.

[0043] It can be seen that the above solution deploys multiple gateways between the terminal device and the server to form multiple communication links, enabling the terminal device to dynamically collect link information (such as latency, packet loss rate, protocol compatibility) of the communication links between the terminal device and multiple candidate gateways, and making an optimal selection among multiple communication links based on the link information. Therefore, the above solution can avoid problems such as service request transmission failures caused by single gateway protocol blocking, server overload, or link congestion, thereby improving the success rate of service requests. The method provided in this specification can effectively solve the problems of connection failure, latency fluctuation, and resource waste caused by network instability in the prior art, providing key technical support for highly reliable and low-latency online services.

[0044] The method for service requests provided in this specification can be executed by a terminal device and applied to scenarios where the terminal device needs to request services from a server. For example, scenarios where the terminal device requests payment services, download services, query services, etc. from the server. It should be noted that the above description of application scenarios is only a part of the multiple usage scenarios provided in this specification. Those skilled in the art should understand that when the service request method and terminal device provided in this specification are applied to other usage scenarios, their implementation methods and technical effects are similar.

[0045] Figure 1 Fig. shows a schematic diagram of an application scenario provided according to an embodiment of this specification.

[0046] As Figure 1 shown, the current application scenario 100 includes: user 110, terminal device 130, multiple gateways 150, and server 170.

[0047] The terminal device 130 may include a mobile device, a tablet computer, a laptop computer, an in-vehicle device of a motor vehicle, or the like, or any combination thereof. In some embodiments, the mobile device may include a smart home device, a smart mobile device, a virtual reality device, an augmented reality device, or the like, or any combination thereof. In some embodiments, the smart home device may include a smart TV, a desktop computer, etc., or any combination. In some embodiments, the smart mobile device may include a smart phone, a personal digital assistant, a gaming device, a navigation device, etc., or any combination thereof. In some embodiments, the virtual reality device or augmented reality device may include a virtual reality headset, virtual reality glasses, augmented reality headset, augmented reality glasses, or the like, or any combination thereof. For example, the virtual reality device or the augmented reality device may include Google Glasses, a head-mounted display, VR, etc. In some embodiments, the in-vehicle device in the motor vehicle may include an in-vehicle computer, an in-vehicle TV, etc.

[0048] Server 170 is a device used to provide background services to terminal device 130. When terminal device 130 needs background services, it can send a service request to Server 170, and then Server 170 provides the required background services to terminal device 130 based on the service request. Server 170 can correspond to a single service device or a computing cluster composed of multiple service devices. Server 170 can be a server adopting a microservices architecture.

[0049] Gateway 150 can also be referred to as an API Gateway (Application Programming Interface Gateway). Gateway 150 is a tool for API management and service governance that integrates functions such as configuration publishing, environment management, access authentication, user authentication, and access control. By using Gateway 150 to host APIs, services can be managed efficiently, securely, and at low cost. As a single entry point for service requests, Gateway 150 distributes the service requests initiated by terminal device 130 to the corresponding microservices in Server 170, and then collects the results and passes them to terminal device 130. In this way, each terminal device 130 only needs to interact with Gateway 150 instead of separately requesting access to each microservice.

[0050] Continue to refer to Figure 1 , in this application scenario 100, there are multiple Gateways 150. Each Gateway 150 is communicatively connected to terminal device 130 and Server 170 respectively. Thus, multiple communication links are formed between terminal device 130 and Server 170. Terminal device 130 can pass the service request to Server 170 through one of the multiple Gateways 150.

[0051] For example, in combination with Figure 1 , when user 110 performs a target operation, terminal device 130 generates a service request based on the target operation triggered by user 110. Furthermore, based on the link information of the communication links between terminal device 130 and multiple Gateways 150, terminal device 130 determines a first target gateway among the multiple Gateways 150, and sends the service request to the first target gateway based on the transmission protocol corresponding to the first target gateway, so as to send the service request to Server 170 through the first target gateway. In addition, terminal device 130 also obtains the service result returned by Server 170 based on the first target gateway.

[0052] In this application scenario, multiple gateways correspond to different transmission protocols. For example, multiple gateways can each have a corresponding transmission protocol; or, multiple gateways can correspond to at least two transmission protocols. When the number of multiple gateways is greater than the number of transmission protocols, multiple gateways can correspond to one transmission protocol. The specific correspondence between the transmission protocol and the gateway can be flexibly adjusted according to the needs of the current application scenario, as long as at least two transmission protocols are included in this application scenario. The setting of at least two transmission protocols can overcome the stability defect of the communication link caused by single-connection dependence.

[0053] The method for service request provided in this specification can be executed by the terminal device 130. At this time, the terminal device 130 can store data or instructions for executing the method for service request described in this specification, and can execute or be used to execute the data or instructions. In some embodiments, the terminal device 130 can include a hardware device with data information processing functions and necessary programs for driving the hardware device to work.

[0054] It should be understood that Figure 1 the numbers of the terminal device 130, multiple gateways 150, and server 170 in

[0055] It should be noted that the user data obtained in this specification has been authorized by the user and does not involve user privacy.

[0056] Figure 2 shows a schematic hardware structure diagram of a computing device 200 provided according to some embodiments of this specification. The computing device 200 can be used as Figure 1 the terminal device 130 in

[0057] As Figure 2 shown, the computing device 200 includes at least one storage medium 230 and at least one processor 220. In some embodiments, the computing device 200 may further include an internal communication bus 210. In some embodiments, the computing device 200 may further include a communication port 250. In some embodiments, the computing device 200 may further include an I / O component 260.

[0058] The internal communication bus 210 can connect different system components, including the storage medium 230 and the processor 220. The I / O component 260 supports input / output between the computing device 200 and other components.

[0059] The communication port 250 is used for the data communication between the computing device 200 and the outside world. For example, the computing device 200 can be connected to a network through the communication port 250.

[0060] The storage medium 230 may include a data storage device. The data storage device can be a non-transitory storage medium or a transitory storage medium. For example, the data storage device may include one or more of a magnetic disk 232, a read-only storage medium (ROM) 234, or a random access storage medium (RAM) 236. The storage medium 230 also includes at least one instruction set stored in the data storage device. The instruction set is computer program code, and the computer program code may include programs, routines, objects, components, data structures, procedures, modules, etc. for executing the method for providing requested services in this specification.

[0061] At least one processor 220 is communicatively connected to at least one storage medium 230 through an internal communication bus 210. The at least one processor 220 is configured to execute the above at least one instruction set. When the terminal device 130 is running, the at least one processor 220 reads the at least one instruction set and executes the method for providing requested services in this specification according to the instructions of the at least one instruction set.

[0062] The processor 220 can execute all steps included in the method for providing requested services. The processor 220 can be in the form of one or more processors. The processor 220 can issue execution instructions. The processor 220 may include one or more hardware processors, such as a microcontroller, a microprocessor, a reduced instruction set computer (RISC), an application-specific integrated circuit (ASIC), an application-specific instruction set processor (ASIP), a central processing unit (CPU), a graphics processing unit (GPU), a physics processing unit (PPU), a microcontroller unit, a digital signal processor (DSP), a field programmable gate array (FPGA), an advanced RISC machine (ARM), a programmable logic device (PLD), any circuit or processor capable of executing one or more functions, etc., or any combination thereof.

[0063] Merely for illustrative purposes, only one processor 220 is shown in the computing device 200 in the accompanying drawings of this specification. However, it should be noted that the computing device 200 in this specification may also include multiple processors. Therefore, the operations and / or method steps disclosed in this specification can be executed by one processor as described in this specification or jointly executed by multiple processors. For example, if the processor 220 of the computing device 200 in this specification executes step A and step B, it should be understood that step A and step B can also be jointly or separately executed by two different processors 220 (for example, the first processor executes step A, the second processor executes step B, or the first and second processors jointly execute steps A and B).

[0064] Figure 3 The flowchart shows a method for requesting a service provided according to an embodiment of this specification; the method P300 for requesting a service can be executed by the terminal device 130. As Figure 3 shown, the method P300 provided in this specification may include S310 - S350, where:

[0065] S310: Generate a service request in response to detecting a target operation triggered by the user.

[0066] In some embodiments, the user can complete a specific operation (such as submitting an order operation or playing a video operation, etc.) on the client interface of the terminal device. After the terminal device detects the target operation triggered by the user, it automatically generates a corresponding service request based on the target operation to send a service request to the server, requesting the server to execute the target operation triggered by the user.

[0067] Among them, the target operation triggered by the user can be an operation for requesting a service, such as: registration operation, login operation, search operation, order - placing operation, payment operation, comment operation, upload operation, search operation, etc. The terminal device requests relevant services from the server based on the target operation.

[0068] The service request can be a request corresponding to the target operation. For example, when the target operation is an order - placing operation, the corresponding service request can be an order - placing request; when the target operation is a payment operation, the corresponding service request can be a payment request; when the target operation is an upload operation, the corresponding service request can be an upload request. It should be understood that the specific content that the target operation may include can be flexibly adjusted according to the user's needs, and is not limited to those given in the above - mentioned embodiments.

[0069] S330: Determine a first target gateway among multiple candidate gateways based on the link information of the communication links between the terminal device and the multiple candidate gateways, and the multiple candidate gateways correspond to different transport protocols.

[0070] In some embodiments, the multiple candidate gateways include at least two of the following: the gateway corresponding to the Transmission Control Protocol (TCP), the gateway corresponding to the User Datagram Protocol (UDP), the gateway corresponding to the Stream Control Transmission Protocol (SCTP), and the gateway corresponding to the Datagram Congestion Control Protocol (DCCP). The specific content included in the specific candidate gateways can be flexibly adjusted according to the needs of the current scenario, and is not limited to those given in the above - mentioned embodiments.

[0071] In the method provided in this specification, since multiple candidate gateways correspond to different transmission protocols, diverse transmission protocols are implemented, avoiding the problems of low transmission efficiency and dependence on a single transmission protocol caused by the blocking of a single transmission protocol. Moreover, the setting of multiple transmission protocols also enables the terminal device to determine the first target gateway in real time according to the link information of the communication links between multiple candidate gateways when determining the first target gateway, thereby improving the overall stability and efficiency of network transmission. In addition, when a certain transmission protocol among multiple transmission protocols is restricted, the terminal device can determine other transmission protocols among multiple transmission protocols, thereby improving the anti-interference ability of the network, ensuring the stability of the connection between the terminal device and the server, and ensuring the continuity of the service.

[0072] In some embodiments, the link information includes but is not limited to: link status information (open or short circuit), link quality information (delay, jitter, packet loss rate, etc.), network environment information (bandwidth utilization rate, protocol blocking status, etc.), and link performance information (transmission success rate, transmission response duration, etc.). By collecting the link information between the terminal device and multiple candidate gateways in real time and selecting the first target gateway based on the link information, the accuracy of the first target gateway selection can be achieved. Compared with the fixed network connection method, the problem of single point of failure can be avoided, and the reliability of transmission is improved.

[0073] Exemplarily, taking the link information including link status information and link performance information as an example for illustration, the terminal device can determine at least one available gateway among multiple candidate gateways based on the link status information of the communication links between the terminal device and multiple candidate gateways. Among them, the link status of the communication link between the terminal device and the available gateway is an open circuit. Further, the terminal device determines the first target gateway among at least one available gateway based on the link performance information of the communication links between the terminal device and at least one available gateway.

[0074] Among them, the link status information of the communication link between the terminal device and the candidate gateway is used to characterize the link status between the current candidate gateway and the terminal device, and it can be either an open circuit or a short circuit. The terminal device selects at least one available gateway with an open circuit link status with the terminal device among multiple candidate gateways based on the link status information of multiple candidate gateways. The above method enables the terminal device to effectively filter out the unavailable gateways that have been disconnected from the terminal device among multiple candidate gateways, and only determines at least one available gateway among multiple candidate gateways, avoiding the attempt of invalid requests.

[0075] In some embodiments, if the number of available gateways is one, the terminal device does not need to make a secondary selection and can directly determine the current available gateway as the first target gateway. If the number of available gateways is more than one, the terminal device can make a secondary selection among at least one available gateway based on the link performance of the communication links between the multiple available gateways to determine the first target gateway among at least one available gateway. It should be understood that the above method of determining the first target gateway enables the terminal device to automatically adapt to the first target gateway of the current network environment according to the link performance of different available gateways, improves the success rate of request response, and at the same time reduces the additional resource consumption caused by repeated attempts, achieving the collaborative optimization of link stability and transmission efficiency.

[0076] Among them, the link status information is obtained by the terminal device through heartbeat detection of the communication link. By sending heartbeat packets to multiple candidate gateways respectively, the terminal device can determine whether there is a blockage of the domain name protocol corresponding to a certain candidate gateway, whether a certain candidate gateway is overloaded, whether a certain candidate gateway has crashed and other faults among the multiple candidate gateways. Thus, the connection status of the communication link between the terminal device and the multiple candidate gateways can be determined in real time, and at the same time, the multiple candidate gateways can also know whether the terminal device is still online.

[0077] In some embodiments, the terminal device can regularly send heartbeat packets to each of the multiple candidate gateways based on a preset time interval. For each candidate gateway: after the candidate gateway receives the heartbeat packet and checks the legality of the heartbeat packet, the candidate gateway will return a response packet for the heartbeat packet to the terminal device to inform the terminal device that the candidate gateway has received the heartbeat packet normally, thereby indicating that the communication link between the candidate gateway and the terminal device is normal. If the terminal device does not receive the response packet returned by the candidate gateway within a certain period of time, it may be considered that there is a problem with the communication link between the terminal device and the candidate gateway, such as gateway failure, network connection interruption, etc. In some embodiments, the link performance information may include: transmission response duration and transmission success rate. Among them, the transmission response duration is used to measure the data transmission speed of the gateway, and the transmission success rate is used to measure the reliability of the gateway data transmission. The terminal device can determine the first performance score for each available gateway based on the transmission response duration of the communication link between the terminal device and the available gateway, determine the second performance score based on the transmission success rate of the communication link between the terminal device and the available gateway, and determine the comprehensive performance score based on the first performance score and the second performance score. Furthermore, the terminal device determines the available gateway with the highest comprehensive performance score among at least one available gateway as the first target gateway.

[0078] Among them, the method in which the terminal device comprehensively scores based on two metrics, namely the transmission response duration and the transmission success rate of each available gateway, can avoid the limitations of a single metric, thereby more comprehensively evaluating the performance of each available gateway. Based on the comprehensive performance scores of at least one available gateway, the terminal device determines the available gateway with the highest comprehensive performance score as the first target gateway. This way of determining the first target gateway takes into account both the speed and reliability of the first target gateway, improves the success rate of service requests, and reduces the problem of resource waste caused by repeated attempts.

[0079] In some possible embodiments, when the terminal device determines the comprehensive performance score based on the first performance score and the second performance score, it can also determine the comprehensive performance score based on a preset weight, the first performance score, and the second performance score. Among them, the preset weight can be predefined by the terminal device; or, there can be multiple preset weights, and then the terminal device determines the preset weight corresponding to the current network state from multiple preset weights according to the current network condition; or, the preset weight can be dynamically adjusted by the terminal device according to the current network state. For example, when the latency is high, the weight of the transmission response duration is set higher, or when the network is unstable, the weight of the transmission success rate is set higher, etc. The above embodiments are only illustrative, and the specific setting method of the preset weight can be flexibly adjusted according to user needs, and is not limited to those given in the above embodiments.

[0080] In some embodiments, the transmission response duration can be obtained by the terminal device probing the communication link, and the transmission success rate can be obtained by the terminal device based on the historical transmission data of the communication link. Among them, the real-time transmission response duration obtained by the terminal device through active probing can directly reflect the instantaneous communication quality of the current communication link (such as dynamic factors such as congestion degree and node load), so as to ensure that the selected first target gateway has the ability to quickly respond to network fluctuations and maintain a high transmission efficiency even in the case of network congestion. The terminal device quantifies and evaluates the long-term stability and protocol reliability of each available gateway based on historical transmission data (such as the success / failure records of the past N requests), and effectively identifies high-risk paths with occasional low latency but frequent packet loss. The terminal device scores the comprehensive performance of each available gateway based on the above two aspects, which can take into account the real-time and stability of data transmission, thus ensuring that the determined first target gateway has high reliability and data transmission efficiency.

[0081] In some embodiments, the link performance information may include performance information in multiple dimensions. After determining the service type requested by the service request, the terminal device may determine the weight information corresponding to the multiple dimensions based on the service type. For each available gateway, the terminal device determines the comprehensive performance score corresponding to the available gateway based on the performance information in multiple dimensions and the weight information corresponding to the multiple dimensions. Furthermore, the terminal device determines the available gateway with the highest comprehensive performance score among at least one available gateway as the first target gateway.

[0082] Exemplarily, the service type may include large-bandwidth transmission services (such as high-definition video streams, file downloads, etc.), real-time interaction services (such as video conferencing, online games, etc.), high-reliability service types (such as financial transaction types, medical telemetry types, etc.), low-power Internet of Things services (such as sensor data reporting, etc.). Different service types may have different requirements for the network. For example, real-time interaction services may require high real-time performance; large-bandwidth transmission services may require high throughput and bandwidth stability; high-reliability services may require low packet loss rate and high transmission success rate; low-power Internet of Things services may need to balance transmission efficiency and energy consumption metrics.

[0083] Therefore, when the service types are different, the weight information corresponding to the multiple dimensions may also be different. After determining the service type requested by the service request, the terminal device may dynamically allocate the weights of each performance dimension for different service types based on the mapping rules (such as configuration tables or machine learning models) between the preset service types and network requirements. For example, for real-time interaction services, the terminal device may increase the weights of latency and jitter and decrease the bandwidth weight; for large-bandwidth transmission services, the terminal device may set the weights of bandwidth and transmission success rate relatively high; for high-reliability services, the terminal device may set the weights of packet loss rate and historical transmission success rate relatively high. It should be understood that the above embodiments are only for illustrative purposes, and the weight information of multiple dimensions corresponding to specific different service types can be flexibly adjusted according to the current scenario needs, and is not limited to those given in the above embodiments.

[0084] Specifically, in the above embodiments, the terminal device determines the corresponding network performance requirements according to the service type requested by the service request, realizing the fine-grained adaptation between the service requirements and the gateway capabilities. Secondly, through the weighted fusion of performance parameters in multiple dimensions, the terminal device takes into account the core indicators in different scenarios (such as latency sensitivity, bandwidth abundance, transmission reliability), effectively preventing the performance short-board effect caused by excessive optimization in a single dimension. Furthermore, based on the comprehensive score corresponding to each available gateway, the terminal device filters out the first target gateway that best fits the current service type among at least one available gateway, thus significantly improving the timeliness of request response, the integrity of data transmission and the continuity of services, and increasing the success rate of service requests.

[0085] S350: Send a service request to the first target gateway based on the transport protocol corresponding to the first target gateway, so that the first target gateway sends the service request to the server.

[0086] In some embodiments, after the terminal device sends a service request to the first target gateway, it also needs to receive a service result from the first target gateway, where the service result is the result obtained by the server based on the service request. Among them, when the terminal device receives the service result returned by the first target gateway, it indicates that the first target gateway has received the service request of the terminal device and processed the service request.

[0087] Among them, the service result may include the execution result of the service request (for example, when the service request is a payment request, the corresponding service result includes the payment result; when the service request is a download request, the corresponding service result includes the download result), the relevant data corresponding to the service request, the feedback data of the network performance, etc. The above content is only for illustrative purposes, and the content included in the specific service result is not limited thereto.

[0088] Exemplarily, in an actual application scenario, due to the high variability of the network physical environment, even the first target gateway determined by screening among multiple candidate gateways may have some availability problems. For example, a sudden network jitter may cause the network quality between the first target gateway and the terminal device to deteriorate and the RTT time to increase. Or, the first target gateway suddenly crashes, which may cause the network service to be unavailable. Therefore, the embodiments of this specification provide a multi-link mutual protection function to handle the above problems, so as to ensure the consistency and stability of the response to the user's service request.

[0089] In some embodiments, if the terminal device does not receive a service result from the first target gateway within a preset time, it means that the first target gateway has not received the service request of the terminal device, or the first target gateway has received the service request of the terminal device but has not processed the service request. At this time, the terminal device determines a second target gateway among other gateways except the first target gateway among multiple candidate gateways, and sends a service request to the second target gateway based on the transport protocol corresponding to the second target gateway, so that the second target gateway sends the service request to the server. Furthermore, the terminal device receives the service result from the second target gateway.

[0090] Among them, the preset time can be the timing time set by the terminal device through a preset timer. The preset time can be any time, such as 3 seconds, 4 seconds, 5 seconds, or 10 seconds, etc. This application does not make any restrictions here. The specific setting of the preset time is determined according to the requirements for the service response time in the current scenario. For scenarios with higher requirements for service response time, the terminal device can set the timing time shorter to ensure timely response to service requests. For scenarios with lower requirements for service response time, the terminal device can set the timing time longer. The specific setting of the timing time can be flexibly adjusted according to user needs, and this application does not make any restrictions here.

[0091] In the above embodiments, the setting of multiple gateways realizes multi-connection mutual protection. The terminal device introduces a time-based retransmission mechanism. When using a timer to detect that no response is received within the preset time, the request is retransmitted through another path. That is, through timeout detection, the terminal device realizes automatic gateway switching when the first target gateway fails to return the service result after exceeding the preset time. The terminal device selects the second target gateway from the remaining candidate gateways after excluding the first gateway, so that the communication between the terminal device and the server can dynamically adapt to network changes, improving the success rate of service requests in scenarios of complex network fluctuations, optimizing the resource utilization rate of the terminal device, systematically enhancing service continuity and user experience robustness, and improving the availability and stability of service requests.

[0092] Specifically, when the number of other gateways is 1 (in the scenario of a single standby gateway), the terminal device can directly determine the other gateway as the second target gateway and send the service request to the server through the second target gateway, thus realizing the rapid selection and switching of the second target gateway and ensuring the rapid recovery of the service. When the number of other gateways is greater than 1 (in the scenario of multiple standby gateways), the terminal device can determine the second target gateway among the other gateways based on the link information of the communication links between the terminal device and each other gateway.

[0093] That is to say, when there are multiple other gateways among the candidate gateways in addition to the first target gateway, the terminal device can select the second target gateway among the other gateways based on the link information of the other gateways. For example, the terminal device can consider factors such as the latency, bandwidth, and success rate of each gateway among the other gateways to select the second target gateway, thus effectively improving the efficiency of data transmission and providing users with a more efficient, secure, and convenient payment service.

[0094] In the above embodiments, the terminal device can adaptively adjust the handover strategy based on the number of candidate gateways, achieving the minimization of computing resource consumption while ensuring service continuity (e.g., performance scoring calculation is exempted in the single gateway scenario). The mutual protection mechanism among the multiple candidate gateways can address issues such as service instability and unavailability caused by network jitter, server downtime, high load, etc., to ensure that the method provided in this specification can maintain a high request success rate and response speed in different network environments.

[0095] In some embodiments, the terminal device determines a second target gateway among other gateways only when the first target gateway fails to return a service result within a preset time. If the second target gateway still fails to return a service result within the preset time, the terminal device can directly determine that the service result for the user is a failure.

[0096] In some embodiments, when the second target gateway still fails to return a service result within the preset time, the terminal device can also determine a third target gateway among other gateways except the first target gateway and the second target gateway, and send a service request to the third target gateway, so that the third gateway sends the service request to the server. The number of times the terminal device repeats to determine a new target gateway can be, for example, a preset number of times. After the preset number of handovers, if the terminal device still does not obtain a service result returned by the target gateway, it can be determined that the service result corresponding to the user's service request is a failure. It should be understood that the above embodiments are only illustrative, and the selection and handover rules of the specific target gateway can be adjusted according to user needs or the actual situation of the current application scenario, and are not limited to those given in the above embodiments.

[0097] In some embodiments, the multiple candidate gateways include a first candidate gateway and a second candidate gateway. The first candidate gateway corresponds to the TCP protocol, and the second candidate gateway corresponds to the UDP protocol. The communication link between the terminal device and the first candidate gateway is a link created before detecting the target operation. The terminal device can create a communication link between the terminal device and the second candidate gateway in response to detecting the target operation. Furthermore, the terminal device disconnects the communication link between the terminal device and the second candidate gateway in response to receiving the service result.

[0098] Specifically, in the above embodiments, before the target operation is triggered, the terminal device pre - establishes a first candidate gateway communication link based on the TCP protocol, and uses the reliable connection feature of TCP to ensure the stability of the initial request transmission, avoiding the handshake delay (such as the time consumed by the TCP three - way handshake) introduced by temporary connection establishment in the traditional solution, thereby shortening the end - to - end response time of the first request. Secondly, when the terminal device detects the target operation, it dynamically creates a second candidate gateway link based on the UDP protocol, giving full play to the advantages of UDP's connectionless and low - overhead characteristics, realizing the rapid distribution of requests in high - concurrency scenarios. At the same time, through the protocol - heterogeneous design (TCP + UDP), it enhances the adaptability to the network environment, automatically switches to the backup protocol channel when a specific protocol is blocked or congested, effectively avoiding the risk of single - protocol dependence.

[0099] Furthermore, after the service result is returned to the terminal device, the terminal device immediately disconnects the communication link with the UDP link, avoiding the problem of invalid resource occupation caused by UDP long - term connections, and realizing the management mechanism of the lightweight connection life cycle of "create on demand - release immediately". This not only meets the short - time interaction requirements with high real - time requirements but also significantly reduces the maintenance cost of the connection pool. That is to say, the terminal device can, through the collaborative mechanism of TCP pre - connection guarantee and UDP dynamic link supplement, while ensuring the reliability of the core service, improve the resource utilization efficiency in high - concurrency and low - latency scenarios, achieving double optimization of transmission stability and response speed.

[0100] In summary, in the method for service requests provided in this specification, after the terminal device generates a service request based on a target operation triggered by a user, it can dynamically determine a first target gateway based on the link information of the communication links between the terminal device and multiple candidate gateways, and send the service request to the server based on the transmission protocol corresponding to the first target gateway. In the above method, through the mechanism of parallel candidate selection of multiple candidate gateways by the terminal device and the diversity of transmission protocols (multiple candidate gateways correspond to different transmission protocols), even during network fluctuations, the terminal device can determine the first target gateway among multiple candidate gateways based on the link information of multiple candidate links, overcoming the stability defect of the communication link caused by single - connection dependence and avoiding request interruption caused by protocol blocking or link congestion. In addition, since the communication link information of multiple candidate gateways is not static, compared with the method of screening the first target gateway based on fixed rules, the method of the terminal device screening the first target gateway based on dynamic link information enables the terminal device to make a suitable selection based on the current actual situation, and the selected first target gateway can effectively match the transmission protocol characteristics of the current network environment, improving the success rate of service requests.

[0101] In some embodiments, for each candidate gateway: The terminal device sends a probe request to the candidate gateway at a preset interval to determine the link status information of the communication link between the terminal device and the candidate gateway. When the terminal device receives the probe response corresponding to the probe request, it indicates that the communication link between the terminal device and the candidate gateway is in a connected state. When the terminal device does not receive the probe response corresponding to the probe request, it indicates that the communication link between the terminal device and the candidate gateway is in a disconnected state. At this time, the terminal device can resend the probe request to the candidate gateway to obtain the probe response corresponding to the probe request returned by the candidate gateway again. When the number of times the terminal device does not receive the probe response corresponding to the probe request exceeds a preset threshold, the communication link between the terminal device and the candidate gateway is disconnected and recreated. The detection mechanism of the link status of each candidate gateway by the terminal device can regularly check the connection status of the communication link between the candidate gateway and the terminal device. When the communication link is in a disconnected state, the communication link between the terminal device and the candidate gateway is recreated in a timely manner to ensure the availability and stability between the terminal device and the candidate gateway.

[0102] Specifically, based on the periodic probe request, the terminal device can monitor the connectivity of the communication link between each candidate gateway and the terminal device in real time, accurately identify communication link failure events caused by network flashes, protocol blockages, or gateway failures, and effectively improve the response speed of fault detection compared with the traditional passive waiting timeout mechanism. Secondly, when the number of consecutive times the terminal device does not receive the probe response exceeds the preset threshold, the disconnection and reconstruction operations of the communication link will be automatically triggered, effectively clearing the "half-open connection" state caused by temporary network jitters or intermediate node anomalies, and avoiding the problem of invalid connections occupying system resources for a long time. Further, the state information of the communication link dynamically maintained by the terminal device provides real-time available data support for the subsequent selection of the target gateway. The terminal device can record and persistently store the state information of the communication link to ensure that the truly effective available nodes can be determined and retained among multiple candidate gateways, significantly reducing the problem of misselection of the target gateway due to outdated communication link information. Finally, through the "monitoring - determination - repair" closed-loop automated management of the communication link, the terminal device realizes the dual improvement of the survival rate and availability of the communication link in a complex network environment, while reducing the manual intervention cost, forming a highly robust adaptive connection maintenance system, and systematically ensuring the continuous reachability of service requests and the resource utilization efficiency of the terminal device.

[0103] That is to say, in the embodiments of this specification, the terminal device has the ability to manage communication links, including the ability to manage TCP and UDP communication links. The ability to manage communication links may include: establishment of communication links, keep-alive of communication links, disconnection of communication links, etc. During this process, for the communication links that have been successfully established, the terminal device needs to send heartbeats regularly. On the one hand, it ensures the activity and availability of the communication links. On the other hand, it can also detect invalid communication links caused by resource recycling in a timely manner.

[0104] Figure 4 The flowchart of a method for requesting services provided by another embodiment of this specification is shown. For example, taking the current target operation as an operation to initiate a payment, the service request as a payment request, and the service result as a payment result for illustration: Figure 4 As shown, after the user initiates a payment request, the terminal device can select a first target gateway among multiple candidate gateways based on the link information of the communication links between the terminal device and the multiple candidate gateways, and send a payment request to the first target gateway based on the transport protocol corresponding to the first target gateway. The terminal device waits for the first target gateway to return a payment result based on a preset time. If the terminal device receives the payment result returned by the first target gateway within the preset time and the payment result indicates that the user's payment is successful, it is determined that the user's payment operation is successful. If the terminal device receives the payment result returned by the first target gateway within the preset time, but the payment result indicates that the user's payment fails, it is determined that the user's payment operation is a failure. If the terminal device does not receive the payment result returned by the first target gateway within the preset time, the terminal device re-determines a second target gateway among the gateways other than the first target gateway and sends a payment request to the second target gateway. Subsequently, the terminal device waits for the second target gateway to return a payment result based on a preset time. If the terminal device receives the payment result returned by the second target gateway within the preset time and the payment result indicates that the user's payment is successful, it is determined that the user's payment operation is successful. If the terminal device receives the payment result returned by the second target gateway within the preset time, but the payment result indicates that the user's payment fails, it is determined that the user's payment operation is a failure. If the terminal device does not receive the payment result returned by the first target gateway within the preset time, it is determined that the user's payment operation is a failure.

[0105] On the other hand, this specification provides a computer-readable non-transitory storage medium storing at least one instruction set for executable instructions to request services. When the at least one instruction set is executed by a processor, the at least one instruction set directs the processor to implement the steps of the method P300 for requesting services in this specification. In some possible implementation manners, various aspects of this specification can also be implemented in the form of a program product, which includes program code. When the program product runs on the terminal device 130, the program code is used to cause the terminal device 130 to execute the steps of the method P300 for service requests described in this specification. The program product for implementing the above method can use a portable compact disc read-only memory (CD-ROM) including program code and can run on the terminal device 130. However, the program product of this specification is not limited thereto. In this specification, the readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system. The program product can adopt any combination of one or more readable media. The readable media can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the readable storage medium include: an electrical connection with one or more wires, a portable disk, a hard disk, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. The computer-readable storage medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium can also be any readable medium other than the readable storage medium, and this readable medium can send, propagate, or transmit a program used by or in combination with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium can be transmitted with any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above. The program code for performing the operations of this specification can be written in any combination of one or more programming languages, including object-oriented programming languages - such as Java, C++, etc., and also including conventional procedural programming languages - such as the "C" language or similar programming languages.

[0106] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require a particular order or a sequential order to achieve the desired result. In certain implementations, multitasking and parallel processing are also possible or may be advantageous.

[0107] In summary, after reading this detailed disclosure, those skilled in the art will understand that the foregoing detailed disclosure may be presented by way of example only and is not necessarily limiting. Although not explicitly stated herein, those skilled in the art can understand that this specification is intended to encompass various reasonable changes, improvements, and modifications to the embodiments. These changes, improvements, and modifications are intended to be proposed by this specification and are within the spirit and scope of the exemplary embodiments of this specification.

[0108] In addition, certain terms in this specification have been used to describe the embodiments of this specification. For example, "one embodiment", "an embodiment", and / or "some embodiments" mean that the specific features, structures, or characteristics described in connection with that embodiment may be included in at least one embodiment of this specification. Thus, it should be emphasized and understood that two or more references to "an embodiment" or "one embodiment" or "alternative embodiments" in various parts of this specification do not necessarily all refer to the same embodiment. Additionally, the specific features, structures, or characteristics may be appropriately combined in one or more embodiments of this specification.

[0109] It should be understood that in the foregoing description of the embodiments of this specification, for the purpose of helping to understand a feature and for the purpose of simplifying this specification, this specification combines various features in a single embodiment, figure, or its description. However, this does not mean that the combination of these features is necessary, and those skilled in the art are quite likely to mark out some of the devices as separate embodiments when reading this specification. That is to say, the embodiments in this specification can also be understood as the integration of multiple sub - embodiments. And the content of each sub - embodiment is also valid when it has fewer features than all the features of a single foregoing disclosed embodiment.

[0110] Each patent, patent application, published patent application, and other materials cited in this disclosure, such as articles, books, specifications, publications, documents, references, etc. (excluding any historical prosecution files associated therewith), are hereby incorporated by reference for all purposes relevant to this disclosure, e.g., in the specification and claims of this disclosure. However, if there is any inconsistency or conflict between the descriptions, definitions, and / or terms of the above materials and those used in this disclosure, the descriptions, definitions, and / or terms used in this disclosure shall prevail.

[0111] Finally, it should be understood that the embodiments of the applications disclosed herein are illustrative of the principles of the embodiments of this specification. Other modified embodiments are also within the scope of this specification. Therefore, the embodiments disclosed in this specification are presented by way of example only and not by way of limitation. Those skilled in the art may implement the applications in this specification by adopting alternative configurations based on the embodiments in this specification. Therefore, the embodiments of this specification are not limited to the embodiments precisely described in the applications.

Claims

1. A method for requesting services, applied to a terminal device, the method comprising: Generating a service request in response to detecting a target operation triggered by a user; Determining a first target gateway from the multiple candidate gateways based on the link information of the communication links between the terminal device and the multiple candidate gateways, where the multiple candidate gateways correspond to different transmission protocols; And Sending the service request to the first target gateway based on the transmission protocol corresponding to the first target gateway, so that the first target gateway sends the service request to the server.

2. The method according to claim 1, wherein The link information includes: link status information and link performance information. Determining the first target gateway from the multiple candidate gateways based on the link information of the communication links between the terminal device and the multiple candidate gateways includes: Determining at least one available gateway from the multiple candidate gateways based on the link status information of the communication links between the terminal device and the multiple candidate gateways, where the link status of the communication link between the terminal device and the available gateway is a pass; and Determining the first target gateway from the at least one available gateway based on the link performance information of the communication links between the terminal device and the at least one available gateway.

3. The method according to claim 2, wherein The link status information includes one of pass or break, and the link status information is obtained by the terminal device through heartbeat detection of the communication link.

4. The method according to claim 2, wherein, The link performance information includes: transmission response duration and transmission success rate. Determining the first target gateway from the at least one available gateway based on the link performance information of the communication links between the terminal device and the at least one available gateway includes: For each available gateway, determining a first performance score based on the transmission response duration of the communication link between the terminal device and the available gateway, determining a second performance score based on the transmission success rate of the communication link between the terminal device and the available gateway, and determining a comprehensive performance score based on the first performance score and the second performance score; and Determining the available gateway with the highest comprehensive performance score among the at least one available gateway as the first target gateway.

5. The method according to claim 4, wherein, The transmission response duration is obtained by the terminal device through detection of the communication link, The transmission success rate is obtained by the terminal device based on the historical transmission data of the communication link.

6. The method according to claim 2, wherein, The link performance information includes performance information in multiple dimensions. Determining the first target gateway from the at least one available gateway based on the link performance information of the communication links between the terminal device and the at least one available gateway includes: Determining the service type requested by the service request, and determining the weight information corresponding to the multiple dimensions based on the service type; For each available gateway, determining the comprehensive performance score corresponding to the available gateway based on the performance information in the multiple dimensions and the weight information corresponding to the multiple dimensions; and Determining the available gateway with the highest comprehensive performance score among the at least one available gateway as the first target gateway.

7. The method according to claim 1, wherein After sending the service request to the first target gateway, the method further includes: Receive a service result from the first target gateway, where the service result is the result obtained by the server based on the service request.

8. The method according to claim 7, wherein, If the service result is not received from the first target gateway within a preset time, the method further includes: Determine a second target gateway from among the other gateways in the multiple candidate gateways excluding the first target gateway; Based on the transmission protocol corresponding to the second target gateway, send the service request to the second target gateway so that the second target gateway sends the service request to the server; and Receive a service result from the second target gateway.

9. The method according to claim 8, wherein, The determining the second target gateway from among the other gateways in the multiple candidate gateways excluding the first target gateway includes: When the number of the other gateways is greater than 1, based on the link information of the communication links between the terminal device and each of the other gateways, determine the second target gateway from among each of the other gateways.

10. The method according to claim 7, wherein, The target operation is an operation of initiating a payment, the service request is a payment request, and the service result is a payment result.

11. The method according to claim 1, wherein, The method further includes: For each candidate gateway: Send a probe request to the candidate gateway at a preset interval to determine the link state information of the communication link between the terminal device and the candidate gateway; and When the number of times the probe response corresponding to the probe request is not received exceeds a preset threshold, disconnect and recreate the communication link between the terminal device and the candidate gateway.

12. The method according to claim 1, wherein, The multiple candidate gateways include at least two of the following: a gateway corresponding to the Transmission Control Protocol, a gateway corresponding to the User Datagram Protocol, a gateway corresponding to the Stream Control Transmission Protocol, and a gateway corresponding to the Datagram Congestion Control Protocol.

13. The method according to claim 12, wherein, The multiple candidate gateways include a first candidate gateway and a second candidate gateway. The first candidate gateway corresponds to the Transmission Control Protocol, and the second candidate gateway corresponds to the User Datagram Protocol. The communication link between the terminal device and the first candidate gateway is a link created before the target operation is detected. The method further includes: In response to detecting the target operation, create a communication link between the terminal device and the second candidate gateway; and In response to receiving the service result corresponding to the service request, disconnect the communication link between the terminal device and the second candidate gateway.

14. A terminal device, comprising: At least one storage medium storing at least one instruction set for requesting a service; And At least one processor communicatively connected to the at least one storage medium, wherein when the at least one processor runs, it reads the at least one instruction set and performs the method according to any one of claims 1-13 above.