Summary of the invention
Embodiments of the invention provide method for communicating between a kind of process that realizes different application on the portable terminal, to communicate between the process that realizes different application on the portable terminal.
A kind of interprocess communication server is arranged in the portable terminal, and described interprocess communication server comprises:
Interface is provided with module, is used for being provided with the interface that is connected with the process of each application program of portable terminal;
Agreement between process and server is provided with module, be used for being provided with and the process of each application program of portable terminal between communication protocol;
The data interaction processing module, be used for by interface with after the process of the application program of transmitting terminal and receiving terminal is connected, the process of the application program of receiving end/sending end sends to these data the process of the application program of receiving terminal by the data that communication protocol sends by communication protocol.
The method of the interprocess communication in a kind of portable terminal is provided with the interprocess communication server in portable terminal, described method specifically comprises:
Described interprocess communication server is connected by the process of interface with the application program of transmitting terminal, the data that the process of the application program of receiving end/sending end sends by communication protocol;
Described interprocess communication server is connected by the process of interface with the application program of receiving terminal, described data is sent to the process of the application program of receiving terminal by communication protocol.
The technical scheme that provides by the embodiment of the invention described above as can be seen, the embodiment of the invention is by being provided with the interprocess communication server in portable terminal, realized the communication between the process of the different application on the portable terminal.
Embodiment
For ease of understanding, be that example is further explained explanation below in conjunction with accompanying drawing with several specific embodiments, and each embodiment does not constitute the qualification to the embodiment of the invention to the embodiment of the invention.
Embodiment one
This embodiment is provided with the interprocess communication server on portable terminals such as mobile phone, utilize this interprocess communication server to realize communication between the process of different application.The structural representation of a kind of interprocess communication server that this embodiment provides comprises as shown in Figure 1 as lower module:
Interface is provided with module 11, is used for being provided with the interface that is connected with the process of each application program of portable terminal, and the process by this each application program of interface can be connected with the interprocess communication server;
Agreement between process and server is provided with module 12, be used for being provided with and the process of each application program of portable terminal between communication protocol, carry out transfer of data by the process of this communication protocol and each application program.
Identical or different communication protocol can be set for the process of different application, in actual applications, TCP (Transmission Control Protocol, transmission control protocol) agreement all be set for all application programs.
Data interaction processing module 13, the process of application program that is used for receiving end/sending end is transmitted to these data the process of the application program of receiving terminal by the data that communication protocol sends by communication protocol.The data that the process of the application program of receiving terminal is returned are transmitted to the process of the application program of transmitting terminal again.
Described interprocess communication server can also comprise:
Agreement between process is provided with module 14, is used to be provided with the communication protocol between the different processes, and this communication protocol can be encapsulated among the communication protocol between process and server.
Described data interaction processing module 13 specifically can comprise:
Receiver module 131, be used for by interface with after the process of the application program of transmitting terminal is connected, the data that the process of the application program of receiving end/sending end sends by the communication protocol that sets in advance;
Decapsulation module 132 is used to utilize the process of application program of the described transmitting terminal that sets in advance and the communication protocol between the interprocess communication server, and the data that described receiver module receives are carried out decapsulation;
Package module 133 is used to utilize the process of application program of the described receiving terminal that sets in advance and the communication protocol between the interprocess communication server, and the data after the described decapsulation module decapsulation are encapsulated once more;
Sending module 134, be used for by interface with after the process of the application program of receiving terminal is connected, the data after by communication protocol described package module being encapsulated once more send to the process of the application program of described receiving terminal.After the process of the application program of receiving terminal receives the data that above-mentioned interprocess communication server sends over, communication protocol between the process of the application program of the receiving terminal that utilization sets in advance and the interprocess communication server is carried out the decapsulation first time to the request of data that receives.Then, utilize the communication protocol between the process of application program of the process of application program of the transmitting terminal set in advance and receiving terminal again, request of data after the decapsulation first time is carried out the decapsulation second time, obtain the data that the process transmission of the application program of transmitting terminal is come.
Embodiment two
Based on above-mentioned interprocess communication server, the handling process of the method for the interprocess communication in a kind of portable terminal that this embodiment provides comprises the steps: as shown in Figure 2
The process A of the application program of step 21, transmitting terminal utilizes the communication protocol that sets in advance, and the data of needs transmission are carried out twice encapsulation.
When the process A of the application program of transmitting terminal needs and the process B of the application program of receiving terminal when carrying out data communication, this process A at first utilizes the process A that sets in advance and the communication protocol between the process B, data to the needs transmission encapsulate the construction data request.
In actual applications, the process of above-mentioned process A embedded recreation in can the QQGame of QQ, above-mentioned process B can be the process of the QQGame of QQ, process A need upload game credits to process B.
Then, utilize the process A set in advance and the communication protocol (such as Transmission Control Protocol) between the interprocess communication server again, above-mentioned request of data is encapsulated once more.
After step 22, interprocess communication server carry out decapsulation, encapsulation operation to the request of data that receives, request of data is sent to the process B of the application program of receiving terminal.
Above-mentioned process A by set in advance and the interprocess communication server between interface, the communication server between connection process.Send to the interprocess communication server by the request of data of communication protocol after again with above-mentioned twice encapsulation.Communication protocol between process A that the interprocess communication server by utilizing sets in advance and the interprocess communication server is carried out decapsulation to the request of data that receives.
Request of data after utilizing the process B set in advance and the communication protocol (such as Transmission Control Protocol) between the interprocess communication server to above-mentioned decapsulation again encapsulates once more, and sends to process B.
Step 23, process B carry out twice decapsulation to the request of data that receives, the data that the process A of obtaining transmits.
After above-mentioned process B receives the request of data that above-mentioned interprocess communication server sends over, utilize the process A that sets in advance and the communication protocol between the interprocess communication server, the request of data that receives is carried out the decapsulation first time.Then, utilize the process A set in advance and the communication protocol between the process B again, the request of data after the decapsulation first time is carried out the decapsulation second time, the data that the process A of obtaining transmits.
After the data that process B transmits above-mentioned process A are handled accordingly, can return corresponding result by the interprocess communication server to process A again according to above-mentioned processing procedure.
One of ordinary skill in the art will appreciate that all or part of flow process that realizes in the foregoing description method, be to instruct relevant hardware to finish by computer program, described program can be stored in the computer read/write memory medium, this program can comprise the flow process as the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random AccessMemory, RAM) etc.
In sum, the embodiment of the invention has realized the communication between the process of the different application on the portable terminal, can be communicating by letter between host program and the plug-in unit (third party's program) a kind of approach is provided, greatly reduce the cost of the program development of portable terminal, improved the development efficiency of portable terminal.
The embodiment of the invention can also be distributed in different functions in the different application programs and realize, realize and need not call by the mode of dynamic link library or static link library, this helps the issue of program, as long as keep communication interface standard constant, just dynamic link library or static link library be needn't upgrade, relative independentability and dependence between each application program guaranteed.
Moreover the embodiment of the invention is sent out for plug-in unit melts good solution is provided, such as in the application of mobile phone browser and so on, provide the communication server to communicate by letter with the plug-in unit of exploitation, as long as the protocol interface of having an agreement between plug-in unit and the browser just can be realized the seamless combination between plug-in unit and the browser.
The above; only for the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, and anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.