Patent Description:
An application (APP) is a computer program running on an operating system and developed to perform one or more specific tasks. An application running on a client may interact with a user and has a visual user interface.

In a data processing mode between a server and an application on a client, the client performs a corresponding operation for received data according to the fixed configuration mode of the server. Such processing mode has the following disadvantages:.

The present disclosure provides a data processing method and apparatus for a client. The client processes protocol data according to a set protocol so that the client intelligently processes the protocol data.

Referring to <FIG> is a flowchart of a data processing method for a client according to this embodiment; <FIG> is a structure diagram of a set protocol according to this embodiment. The method in this embodiment is applicable to a scenario where the client processes data acquired from a server and may be performed by the client. The client may be disposed in a terminal. The terminal includes, but is not limited to, a television set, a personal computer, a mobile phone, a personal digital assistant (PDA), and the like.

As shown in <FIG>, the data processing method for a client provided in this embodiment may include the steps described below.

In step <NUM>, protocol data is acquired from the server, where the protocol data is formed by encapsulating transmission data in a set protocol by the server.

For example, the client is a program that corresponds to the server and provides a local service to a user. The client is communicatively connected to the server. In this embodiment, the server and the client predetermine the set protocol for a specified application, and the server formulates the application on the client according to the set protocol. Before service data is transmitted to the client, the service data to be transmitted is encapsulated in the set protocol to form the protocol data. The client acquires the protocol data from the server.

As shown in <FIG>, the set protocol agreed between the client and the server includes a protocol header, a protocol body and a protocol exception-processing part. The protocol header may include version information for identifying the set protocol and client information applicable to the set protocol. The protocol body may include two parts: normal-processing logic and exception-processing logic. The client processes the application according to the content of the protocol body. The normal-processing logic refers to protocol content in which the client can normally process the application according to the content included in the normal-processing logic. The exception-processing logic refers to protocol content in which the client processes the application according to the content included in the exception-processing logic when the client cannot process the application according to the normal-processing logic and the set protocol is applicable to the current client. The content of the exception-processing logic is different from the content of the normal-processing logic. The protocol exception-processing part refers to protocol content executed by the client in response to determining that the set protocol is not applicable to the current client on the basis of the protocol header. Furthermore, when the client to which the set protocol is applicable cannot process the application according to the content of the protocol body, the client may also process the application according to the content of the protocol exception-processing part.

The client may process the application by executing the protocol data. For example, the client processes the application by executing the service data in the protocol data according to the processing logic provided by the protocol body. The service data may include service data instructing operations like opening the application, updating the application or deleting the application.

In step <NUM>, the protocol data is parsed to obtain the set protocol.

For example, parsing the protocol data is decapsulating the protocol data. The decapsulating is an inverse process of the data encapsulation in step <NUM>. The client parses the acquired protocol data to obtain the set protocol part of the protocol data and the encapsulated service data part. When the protocol data is decapsulated, the protocol data can be parsed into three different containers: a protocol header container, a protocol body container and a protocol exception container.

In step <NUM>, the protocol header, the protocol body and the protocol exception-processing part of the set protocol are identified.

For example, the protocol header, the protocol body and the protocol exception-processing part of the set protocol are identified on the basis of the content obtained from the three different containers at the time of parsing the protocol data. As shown in <FIG>, the protocol body may include normal-processing logic and exception-processing logic. The client executes the application and processes the protocol data according to the normal-processing logic, and executes the application and processes the protocol data according to the exception-processing logic. When the client fails to process the protocol data by executing the application according to the exception-processing logic, the client executes the application and processes the protocol data according to the protocol exception-processing part.

For example, the protocol body and the protocol exception-processing part may be independent of each other in the set protocol. When the client processes the application according to the content of the protocol body, the client does not need to parse the content of the exception-processing part, thereby reducing processing time and resource occupation. The protocol body and the protocol exception-processing part may also be combined. That is, the protocol body may also include the protocol exception-processing part, so that the client can also read the content of the protocol exception-processing part when executing the protocol body.

In step <NUM>, the protocol data is processed according to the protocol header, the protocol body and the protocol exception-processing part.

For example, the client determines, according to the identification information in the protocol header, whether the set protocol is applicable to the current client, and the client chooses to process the protocol data according to the content of the protocol body obtained from parsing or to process the protocol data according to the content of the protocol exception-processing part obtained from parsing.

In this embodiment, a unified set protocol is agreed between the server and the client; when the server transmits data to the client, the data to be transmitted is first encapsulated in the set protocol to form protocol data and then transmitted; and after acquiring the protocol data, the client parses the protocol data, identifies the protocol header, the protocol body and the protocol exception-processing part of the set protocol, and executes the application and processes the protocol data according to the protocol header, the protocol body and the protocol exception-processing part. This enables the client to execute the application and intelligently process the protocol data, avoids the problem where the client cannot normally execute the application or process the protocol data due to data incompatibility or the like during subsequent expansion and update, and is beneficial to the sustainable development of software between the server and the client.

Referring to <FIG> is a flowchart of a data processing method for a client according to an embodiment. As shown in <FIG>, the data processing method for a client provided in this embodiment may include the steps described below.

In step <NUM>, whether the set protocol is applicable to the client is determined according to the protocol header.

For example, the protocol header may include version information of the set protocol and client information applicable to the set protocol. The current client determines whether the set protocol is applicable to the current client and whether the version of the set protocol is applicable to the current client according to the content of the protocol header. In condition that the set protocol and the version of the set protocol are determined to be applicable to the current client, step <NUM> is performed; otherwise, step <NUM> is performed.

In step <NUM>, the protocol data is processed according to the protocol body.

In step <NUM>, the protocol data is processed according to the protocol exception-processing part.

Optionally, in step <NUM>, when the client executes the application and processes the protocol data according to the content of the protocol body, the client executes the application and processes the protocol data according to normal-processing logic in the protocol body, and in condition that the processing fails, the client executes the application and processes the protocol data according to exception-processing logic in the protocol body.

Optionally, when the client fails to execute the application and process the protocol data according to the exception-processing logic in the protocol body, the client jumps to step <NUM> to process the protocol data according to the protocol exception-processing part.

For example, in condition that the set protocol is applicable to the current client, the client processes the application according to the normal-processing logic, and in condition that the processing can be normally implemented, the client continues processing the application according to the normal-processing logic until the processing is completed; in condition that the client cannot process the application according to the normal-processing logic or an exception occurs when the client processes the application according to the normal-processing logic, the client processes the application according to the exception-processing logic, and in condition that the processing can be smoothly implemented, the client continues processing the application according to the exception-processing logic until the processing is completed; in condition that the client cannot process the application according to the exception-processing logic or an exception occurs when the client processes the application according to the exception-processing logic, the client processes the application according to the protocol exception-processing part until the processing is completed.

In this embodiment, a unified set protocol is agreed between the server and the client; when the server transmits data to the client, the data to be transmitted is first encapsulated in the set protocol to form protocol data and then transmitted; and after acquiring the protocol data, the client parses the protocol data, identifies the protocol header, the protocol body and the protocol exception-processing part of the set protocol, determines whether the set protocol is applicable to the client, executes the application and performs the protocol data according to the protocol body if the set protocol is applicable to the client, and executes the application and performs the protocol data according to the protocol exception-processing part if the set protocol is not applicable to the client. This enables the client to execute the application and intelligently process the protocol data, avoids the problem where the client cannot normally execute the application or process the protocol data due to data incompatibility or the like during subsequent expansion and update, and is beneficial to the sustainable development of software between the server and the client.

This embodiment further provides a data processing apparatus for a client. The data processing apparatus and the data processing methods provided in the preceding embodiments are guided by the same inventive concept. For what is not detailed in the apparatus embodiment, see the preceding method embodiments.

Referring to <FIG> and <FIG>, <FIG> is a structure diagram of a data processing apparatus for a client according to an embodiment and <FIG> is a structure diagram of a protocol data processing module <NUM> of <FIG> according to an embodiment.

The data processing apparatus <NUM> for a client provided in this embodiment may include:.

Optionally, the protocol body includes normal-processing logic and exception-processing logic.

Optionally, as shown in <FIG>, the protocol data processing module <NUM> may include:.

Optionally, the second processing unit <NUM> is further configured to:
process the protocol data according to the normal-processing logic, and in condition that the processing fails, process the protocol data according to the exception-processing logic.

Optionally, the second processing unit <NUM> is further configured to:
process the protocol data according to the exception-processing logic, and in condition that the processing fails, process the protocol data according to the protocol exception-processing part.

This embodiment further provides a computer-readable storage medium storing computer-executable instructions for performing any of the methods described above.

<FIG> is a structure diagram of hardware of a terminal according to an embodiment. As shown in <FIG>, the terminal includes a processor <NUM> and a memory <NUM>, and may further include a communication interface <NUM> and a bus <NUM>.

The processor <NUM>, the memory <NUM> and the communication interface <NUM> may communicate with each other through the bus <NUM>. The communication interface <NUM> may be used for information transmission. The processor <NUM> may call logic instructions in the memory <NUM> to perform any of the methods in the preceding embodiments.

The memory <NUM> may include a program storage region and a data storage region, where the program storage region may store an operating system and an application program required by at least one function while the data storage region may store data created depending on use of a terminal device. Furthermore, the memory may include, for example, a volatile memory of a random access memory, and may further include a non-volatile memory, such as at least one disk memory, a flash memory or other non-transient solid-state memories.

In addition, the logic instructions in the memory <NUM> may be implemented in the form of a software function unit and, when sold or used as an independent product, may be stored in a computer-readable storage medium. The solution of the present invention may be embodied in the form of a software product that is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method provided in this embodiment.

The storage medium may be a non-transient storage medium or a transient storage medium. The non-transient storage medium may include: a U disk, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disk or other media that can store program codes.

All or part of the procedure steps in the methods of the preceding embodiments may be implemented by related hardware instructed by one or more computer programs. These programs may be stored in a non-transient computer-readable storage medium. During the execution of these programs, the steps in the preceding method embodiments may be implemented.

Claim 1:
A data processing method for a client, comprising:
acquiring (<NUM>) protocol data from a server, wherein the protocol data is formed by encapsulating transmission data in a set protocol by the server;
parsing (<NUM>) the protocol data to obtain the set protocol;
identifying (<NUM>) a protocol header, a protocol body and a protocol exception-processing part of the set protocol; and
processing (<NUM>) the protocol data according to the protocol header, the protocol body and the protocol exception-processing part;
characterized in that,
wherein the processing comprises:
determining, according to the protocol header, whether the set protocol is applicable to the client;
processing the protocol data according to the protocol body in response to determining that the set protocol is applicable to the client according to the protocol header and not processing the protocol exception-processing part; and
processing the protocol data according to the protocol exception-processing part in response to determining that the set protocol is inapplicable to the client according to the protocol header and not processing the protocol body.