CN107483399A - A kind of Information encapsulation method and device in remote procedure call - Google Patents

A kind of Information encapsulation method and device in remote procedure call Download PDF

Info

Publication number
CN107483399A
CN107483399A CN201710524061.1A CN201710524061A CN107483399A CN 107483399 A CN107483399 A CN 107483399A CN 201710524061 A CN201710524061 A CN 201710524061A CN 107483399 A CN107483399 A CN 107483399A
Authority
CN
China
Prior art keywords
call parameters
call
type
serializing
parameters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710524061.1A
Other languages
Chinese (zh)
Other versions
CN107483399B (en
Inventor
杨亮
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Crosstrust Network Technology Co.,Ltd.
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710524061.1A priority Critical patent/CN107483399B/en
Publication of CN107483399A publication Critical patent/CN107483399A/en
Application granted granted Critical
Publication of CN107483399B publication Critical patent/CN107483399B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/06Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a kind of Information encapsulation method in remote procedure call, including:When calling end to carry out remote procedure call, it is determined that the data structure of the recalls information for calling the remote process, preset field is included in the data structure;Obtain the call parameters for calling the remote process;The call parameters are serialized, obtain serializing call parameters;The serializing call parameters are write in the preset field, obtain the recalls information.The present invention realizes the technique effect of information transfer efficiency when improving remote procedure call.Meanwhile the invention also discloses a kind of Information encapsulation device in remote procedure call.

Description

A kind of Information encapsulation method and device in remote procedure call
Technical field
The present invention relates to network direct broadcasting technical field, more particularly to a kind of Information encapsulation method in remote procedure call And device.
Background technology
With the progress of the network communications technology and the speed-raising of broadband network, network direct broadcasting obtained it is increasing development and Using.During network direct broadcasting, remote procedure call is often carried out.
So-called remote procedure call, exactly a process call the method that another process is provided, and are calling end As angle, remote procedure call and the function for calling this process., it is necessary to which the calling for calling end is believed in remote procedure call Breath is sent to called terminal by network, and after corresponding service is completed in called terminal processing, caused object information is passed through into net Network, which returns to, calls end.
But in the prior art, by network to called terminal send recalls information when, information transfer efficiency compared with Low, this has had a strong impact on the calling of remote process.
The content of the invention
The embodiment of the present application solves existing by providing a kind of Information encapsulation method and device in remote procedure call Have in technology when carrying out remote procedure call, the low technical problem of existence information efficiency of transmission, realize raising remote process The technique effect of information transfer efficiency during calling.
In a first aspect, the application provides following technical scheme by the embodiment of the application:
A kind of Information encapsulation method in remote procedure call, including:
When calling end to carry out remote procedure call, it is determined that the data knot of the recalls information for calling the remote process Structure, preset field is included in the data structure;
Obtain the call parameters for calling the remote process;
The call parameters are serialized, obtain serializing call parameters;
The serializing call parameters are write in the preset field, obtain the recalls information.
Preferably, it is described that the call parameters are serialized, serializing call parameters are obtained, including:
Determine the data type of the call parameters;
The data type of the call parameters is converted into remote procedure call parameter IRpcArgument types, obtains institute State serializing call parameters.
Preferably, the data type of the call parameters, including:
Integer type or byte Type or floating point type or ASCII ascii character string type or UNICODE Unicode character string types or array type or object type.
Preferably, the data type by the call parameters is converted into remote procedure call parameter IRpcArgument Type, including:
When the data type of the call parameters is integer type, the integer value of the call parameters is set to described In the m_intValue fields for serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_ I32 types;
When the data type of the call parameters is byte Type, the byte value of the call parameters is set and arrives institute In the m_i8Value fields for stating serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_I8 types;
When the data type of the call parameters is floating point type, the floating point values of the call parameters is set to described In the m_singleValue fields for serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_SINGLE types;
When the data type of the call parameters is ascii character string type, by the ascii character of the call parameters String copy to it is described serializing call parameters m_charBuffer fields in, and by it is described serializing call parameters m_type Field is arranged to RAT_STRING types;
When the data type of the call parameters is Unicode character string types, by the Unicode of the call parameters Character string is copied in the m_wcharBuffer fields of the serializing call parameters, and by the serializing call parameters M_type fields are arranged to RAT_WSTRING types;
When the data type of the call parameters is array type, the array element of the call parameters is set and arrives institute In the m_elementNum fields for stating serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_BLOB types;
When the data type of the call parameters is object type, the structure element of the call parameters is set and arrived In the m_elementNum fields of the serializing call parameters, and the m_type fields of the serializing call parameters are set For RAT_OBJECT types.
Preferably, it is described to write the serializing call parameters in the preset field, including:
Based on the data type of the call parameters, the serializing call parameters are write in the preset field.
Preferably, it is described based on the call parameters when the data type of the call parameters is non-object type Data type, the serializing call parameters are write in the preset field, including:
If the data type of the call parameters is non-array type, the first word is sequentially added in the preset field Section and the second byte, first byte is used to preserve the information in the m_type fields of the serializing call parameters, described Second byte is used for the parameter value for preserving the call parameters.
Preferably, it is described based on the call parameters when the data type of the call parameters is non-object type Data type, the serializing call parameters are write in the preset field, including:
If the data type of the call parameters is array type, the first word is sequentially added in the preset field Section, the 3rd byte and the second byte, first byte are used to preserve in the m_type fields for serializing call parameters Information, the number for the array element that the 3rd byte is used in the call parameters, second byte are described for preserving The parameter value of call parameters.
Second aspect, the application provide following technical scheme by the embodiment of the application:
A kind of Information encapsulation device in remote procedure call, including:
Determining unit, for call end carry out remote procedure call when, it is determined that the tune for calling the remote process With the data structure of information, preset field is included in the data structure;
Acquiring unit, for obtaining the call parameters for being used for calling the remote process;
Serialization unit, for being serialized to the call parameters, obtain serializing call parameters;
Writing unit, for the serializing call parameters to be write in the preset field, obtain the recalls information.
The third aspect, the application provide following technical scheme by the embodiment of the application:
A kind of Information encapsulation device in remote procedure call, including memory, processor and storage are on a memory And the computer program that can be run on a processor, following steps are realized during the computing device described program:
When calling end to carry out remote procedure call, it is determined that the data knot of the recalls information for calling the remote process Structure, preset field is included in the data structure;Obtain the call parameters for calling the remote process;Ginseng is called to described Number is serialized, and obtains serializing call parameters;The serializing call parameters are write in the preset field, obtain institute State recalls information.
Fourth aspect, the application provide following technical scheme by the embodiment of the application:
A kind of computer-readable recording medium, is stored thereon with computer program, and the program is realized when being executed by processor Following steps:
When calling end to carry out remote procedure call, it is determined that the data knot of the recalls information for calling the remote process Structure, preset field is included in the data structure;Obtain the call parameters for calling the remote process;Ginseng is called to described Number is serialized, and obtains serializing call parameters;The serializing call parameters are write in the preset field, obtain institute State recalls information.
The one or more technical schemes provided in the embodiment of the present application, have at least the following technical effects or advantages:
In the embodiment of the present application, a kind of Information encapsulation method in remote procedure call is disclosed, including:Calling When end carries out remote procedure call, it is determined that the data structure of the recalls information for calling the remote process, the data knot Preset field is included in structure;Obtain the call parameters for calling the remote process;The call parameters are serialized, Obtain serializing call parameters;The serializing call parameters are write in the preset field, obtain the recalls information. When carrying out remote procedure call, recalls information is obtained using this method, then recalls information is sent to remote process by network Called terminal, information transfer efficiency during remote procedure call can be greatly improved, entered in the prior art so as to solve During row remote procedure call, the low technical problem of existence information efficiency of transmission.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, make required in being described below to embodiment Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the present invention, for this For the those of ordinary skill of field, on the premise of not paying creative work, it can also be obtained according to these accompanying drawings other Accompanying drawing.
Fig. 1 is a kind of flow chart of Information encapsulation method in remote procedure call in the embodiment of the present application;
Fig. 2 is a kind of structure chart of Information encapsulation device 200 in remote procedure call in the embodiment of the present application;
Fig. 3 is a kind of structure chart of Information encapsulation device 300 in remote procedure call in the embodiment of the present application;
Fig. 4 is a kind of schematic diagram of computer-readable recording medium in the embodiment of the present application.
Embodiment
The embodiment of the present application solves existing by providing a kind of Information encapsulation method and device in remote procedure call Have in technology when carrying out remote procedure call, the low technical problem of existence information efficiency of transmission, realize raising remote process The technique effect of information transfer efficiency during calling.
The technical scheme of the embodiment of the present application is in order to solve the above technical problems, general thought is as follows:
A kind of Information encapsulation method in remote procedure call, including:When calling end to carry out remote procedure call, really Determine the data structure for being used to call the recalls information of the remote process, preset field is included in the data structure;Obtain and use In the call parameters for calling the remote process;The call parameters are serialized, obtain serializing call parameters;By institute State serializing call parameters to write in the preset field, obtain the recalls information.
In order to be better understood from above-mentioned technical proposal, below in conjunction with Figure of description and specific embodiment to upper Technical scheme is stated to be described in detail.
Embodiment one
A kind of Information encapsulation method in remote procedure call is present embodiments provided, applied in terminal device, institute Stating terminal device can be:PC (Personal Computer, PC) or smart mobile phone or tablet personal computer or intelligence Which kind of equipment TV etc., be specifically for the terminal device, and the present embodiment is not specifically limited.
As shown in figure 1, the Information encapsulation method in remote procedure call, including:
Step S101:When calling end to carry out remote procedure call, it is determined that recalls information for calling remote process Data structure, a preset field is included in the data structure.Wherein, the preset field is args fields hereinafter.
In the present embodiment, a kind of new types of data structure is provided for above-mentioned recalls information, i.e. RpcMessage (Remote Procedure CallsMessage, remote procedure call information) structure, the data structure are to be based on binary system , in RpcMessage structures comprising following field (i.e.:The field in A1~A7 hereinafter):
(A1) Version (version), the field is used for representing the version information of the RpcMessage, between different processes Transmission information (such as:End is called to issue the recalls information of called terminal, or the object information for calling end to return to called terminal) When, it is necessary to assure the uniformity of version, if version is inconsistent, just represent the data structure used between two different processes not Unanimously, this may result in logical miss, the problems such as program crashing.
(A2) rpcType (Remote Procedure CallsType, remote procedure call type), the field are used for marking It is from the message call for calling end process, or the results messages from called terminal process to know transmission information.When the field Value when being RPC_MESSAGE_REQUEST, represent from the message call for calling end process, when the value of the field is RPC_ During MESSAGE_RESPONSE, the results messages from called terminal process are represented.
(A3) gid (unique identifier symbol), the field are used for one transmission information of unique mark, generated from calling end end, After following recalls information to be sent to called terminal processing, the gid can be returned to and be called end by called terminal together with object information.
(A4) numArgs, the field value are used for representing the call parameters number for calling end to be passed to when calling remote method, or Person, the field value are used for representing that called terminal returns to the result number for calling end.
(A5) varLength, the field value represent the internal memory byte-sized that numArgs fields occupy.
(A6) procedure, the remote method title to be called of the field references.
(A7) args, the field references call all call parameters that end is provided, or, the field references called terminal All results returned.
Step S102:Obtain the call parameters for calling remote process.
In specific implementation process, end is called to use multiple call parameters when carrying out far call, need to obtain herein Take whole call parameters.
Step S103:Call parameters are serialized, obtain serializing call parameters.
As an alternative embodiment, step S103, including:
Determine the data type of call parameters;The data type of call parameters is converted into IRpcArgument (Remote Procedure CallsArgument, remote procedure call parameter) type, obtain serializing call parameters.
Wherein, the data type of the call parameters, including:Integer type or byte Type or floating point type or ASCII (American Standard Code for Information Interchange, ASCII) Character string type or Unicode (UNICODE) character string types or array type or object type.
In specific implementation process, the field that IRpcArgument types include has:m_intValue、m_i8Value、m_ singleValue、m_charBuffer、m_wcharBuffer、m_elementNum、m_type。
As an alternative embodiment, described be converted into remote procedure call parameter by the data type of call parameters IRpcArgument types, including situations below is (i.e.:The situation in B1~B7 hereinafter):
(B1) integer type serializes:Type is exactly converted into IRpcArgument classes for the call parameters of int types Type.
Specifically, when the data type of call parameters is integer type, the integer value of call parameters can be set RAT_ is arranged into the m_intValue fields of serializing call parameters, and by the m_type fields for serializing call parameters I32 types.
(B2) byte Type serializes:The call parameters that type is char are exactly converted into IRpcArgument types.
Specifically, when the data type of call parameters is byte Type, the byte value of call parameters can be set In the m_i8Value fields for putting serializing call parameters, and the m_type fields for serializing call parameters are arranged to RAT_ I8 types.
(B3) floating point type serializes:The call parameters that type is float are exactly converted into IRpcArgument types.
Specifically, when the data type of call parameters is floating point type, the floating point values of call parameters can be set It is arranged into the m_singleValue fields of serializing call parameters, and by the m_type fields for serializing call parameters RAT_SINGLE types.
(B4) ascii string type sequence:Exactly the call parameters for the character string that type is char* are converted into IRpcArgument types.
Specifically, can be by call parameters when the data type of call parameters is ascii character string type Ascii string is copied in the m_charBuffer fields of serializing call parameters, and the m_ that will serialize call parameters Type fields are arranged to RAT_STRING types.
(B5) Unicode character string types serialize:It is exactly to turn the call parameters for the character string that type is wchar_t* Turn to IRpcArgument types.
Specifically, can be by call parameters when the data type of call parameters is Unicode character string types Unicode character strings are copied in the m_wcharBuffer fields of serializing call parameters, and the m_ that will serialize call parameters Type fields are arranged to RAT_WSTRING types.
(B6) array type serializes:The call parameters of array type are exactly converted into IRpcArgument types.
Specifically, when the data type of call parameters is array type, the array element of call parameters can be set In the m_elementNum fields for putting serializing call parameters, and the m_type fields for serializing call parameters are arranged to RAT_BLOB types.
(B7) object type serializes:The call parameters of structure type are exactly converted into IRpcArgument types.
Specifically, can be by the structure element of call parameters when the data type of call parameters is object type In the m_elementNum fields that serializing call parameters are set, and the m_type fields for serializing call parameters are arranged to RAT_OBJECT types.
Step S104:Serializing call parameters are write in preset field, obtain recalls information.
In specific implementation process, step S104 effect is exactly by all IRpcArgument in rowization call parameters Value sequence into RpcMessage args fields, can by call BuildRpcMessageFrom functions realize by All IRpcArgument argument sequences turn to a RpcMessage structure, so as to carry out network transmission.
As an alternative embodiment, step S104, including:Data type based on call parameters, it will serialize In call parameters write-in preset field.
In specific implementation process, when performing step S104, two kinds of situations can be divided into, a kind of is to work as call parameters Data type is the situation of non-object type, and another kind is when the situation that the data type of call parameters is object type.
As an alternative embodiment, when the data type of call parameters is non-object type, it is described based on tune With the data type of parameter, serializing call parameters are write in preset field, including (two kinds of situations of C1 and C2 hereinafter):
(C1) if the data type of call parameters is non-array type, sequentially added in preset field the first byte and Second byte, the information that the first byte is used in the m_type fields of saving sequence call parameters, the second byte are used to preserve The parameter value of call parameters.
For example, if a call parameters are int types, in the args fields of serializing call parameters, the 1st Byte is (i.e.:First byte) value is RAT_I32,4 bytes below are (i.e.:Second byte) value be the call parameters value.
(C2) if the data type of call parameters is array type, the first byte, are sequentially added in preset field Three bytes and the second byte, the information that the first byte is used in the m_type fields of saving sequence call parameters, the 3rd byte For the number of the array element in call parameters, the second byte is used for the parameter value for preserving call parameters.
For example, if the call parameters are array types, then, in the args fields of serializing call parameters, 1st byte is (i.e.:First byte) value is RAT_BLOB, 4 bytes below are (i.e.:3rd byte) be the array element Number sizes, then followed by byte (i.e.:Second byte) be the array value.A for example, byte number for having 10 elements Group, it is respectively that " 1,2,3,4,5,6,7,8,9,10 ", then the memory value for serializing call parameters is " 8 10 0001234 56789 10 ", wherein, the 1st " 8 " represent the value and represent an array type, and " 10 000 " below are 4 words The integer value of section, wherein " 10 " represent the element number of the array, followed by all bytes (i.e.:“1 2 3 4 5 6 7 8 9 10 " content) is exactly the value of the array.
As an alternative embodiment, when the data type of call parameters is object type, it is described based on calling The data type of parameter, serializing call parameters are write in preset field, including (i.e.:D hereinafter):
(D) if the parameter type is object type, then, in the args fields of serializing call parameters, the 1st word Section is still the information in the m_type fields of the serializing call parameters, and 4 bytes below are the element numbers of the structure, Then, for each element in the object, if the element is non-array type, above-mentioned steps C1 is performed, if should Element is array type, then performs above-mentioned steps C2, if the element is an object type again, carries out recurrence again and performs sheet Step D, perform successively.
After recalls information is obtained based on this method, that is, the encapsulation to call parameters is completed, call end to pass through net The recalls information is sent to the called terminal of remote process by road, and called terminal is after the recalls information is received, it is necessary to this Recalls information decapsulates, and is exactly to carry out unserializing to serializing call parameters therein, so as to obtain the remote parties to be performed The call parameters of religious name and correlation.
For example, called terminal is as follows to the decapsulation process of recalls information:
Called terminal can read the 1st byte in the args fields of recalls information (i.e.:First byte), for judging The serializing call parameters are object type or non-object type, and when the byte is not equal to RAT_OBJECT values, representing should It is a non-object type to serialize call parameters, then enters following step D1~D6 and carry out unserializing decoding, when the value During equal to RAT_OBJECT values, it is an object type to represent the serializing call parameters, then enters following step E and carry out instead Serializing decoding.
(D1) integer type:When it is RAT_I32 to serialize the m_type field values in call parameters, then the sequence is represented Change call parameters be an integer type, then read args fields in the second byte (such as:4 words behind 1st byte Section) content, so as to obtain the value of the call parameters.
(D2) byte Type:When it is RAT_I8 to serialize the m_type field values in call parameters, the serializing is represented Call parameters are a byte Types, then read args fields in the second byte (such as:1 byte behind 1st byte) Content, so as to obtain the value of the call parameters.
(D3) floating point type:When it is RAT_SINGLE to serialize the m_type field values in call parameters, the row are represented Change call parameters be a floating point type, then read args fields in the second byte (such as:4 words behind 1st byte Section) content, so as to obtain the value of the call parameters.
(D4) ascii character string type:When it is RAT_STRING to serialize the m_type field values in call parameters, generation The table row call parameters are an ascii strings, then the content in args fields are read, untill reading 0, so as to obtain Obtain the content of the ascii string.
(D5) Unicode character string types:It is RAT_WSTRING when serializing the m_type field values in call parameters When, it is a Unicode character string to represent the row call parameters, then reads the content in args fields, be until reading 0 Only, so as to obtaining the content of the Unicode character strings.
(D6) array type:When it is RAT_BLOB to serialize the m_type field values in call parameters, represents rowization and adjust An array type with the parameter, then read args fields in the second byte (i.e.:Such as:4 words after 1st byte Section) content, obtain the number n of the array element, then read the content of this n byte, so as to obtain owning for the array Element value.
(E) object type:When it is RAT_OBJECT to serialize the m_type field values in call parameters, then args is read Second byte in field (such as:4 bytes behind 1st byte) content, obtain the member of inside n of the object type Element, then, to this n element, the recursive process performed in above-mentioned steps D1~D6 successively, so as to be called to each serializing Parameter carries out unserializing, obtains call parameters therein.
By this method, message encapsulation and the decapsulation during RMI are realized, due to this method It is to be carried out based on binary form, so in network transmission process, required byte number is smaller, has higher biography Defeated efficiency.
Technical scheme in above-mentioned the embodiment of the present application, at least has the following technical effect that or advantage:
In the embodiment of the present application, a kind of Information encapsulation method in remote procedure call is disclosed, including:Calling When end carries out remote procedure call, it is determined that the data structure of the recalls information for calling the remote process, the data knot Preset field is included in structure;Obtain the call parameters for calling the remote process;The call parameters are serialized, Obtain serializing call parameters;The serializing call parameters are write in the preset field, obtain the recalls information. When carrying out remote procedure call, recalls information is obtained using this method, then recalls information is sent to remote process by network Called terminal, information transfer efficiency during remote procedure call can be greatly improved, entered in the prior art so as to solve During row remote procedure call, the low technical problem of existence information efficiency of transmission.
Embodiment two
Based on same inventive concept, as shown in Fig. 2 present embodiments providing a kind of information envelope in remote procedure call Assembling device 200, including:
Determining unit 201, for call end carry out remote procedure call when, it is determined that for calling the remote process The data structure of recalls information, preset field is included in the data structure;
Acquiring unit 202, for obtaining the call parameters for being used for calling the remote process;
Serialization unit 203, for being serialized to the call parameters, obtain serializing call parameters;
Writing unit 204, for the serializing call parameters to be write in the preset field, obtain described call and believe Breath.
As an alternative embodiment, serialization unit 203, is specifically used for:
Determine the data type of the call parameters;The data type of the call parameters is converted into remote procedure call Parameter IRpcArgument types, obtain the serializing call parameters.
As an alternative embodiment, the data type of the call parameters, including:
Integer type or byte Type or floating point type or ASCII ascii character string type or UNICODE Unicode character string types or array type or object type.
As an alternative embodiment, serialization unit 203, is specifically used for:
When the data type of the call parameters is integer type, the integer value of the call parameters is set to described In the m_intValue fields for serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_ I32 types;
When the data type of the call parameters is byte Type, the byte value of the call parameters is set and arrives institute In the m_i8Value fields for stating serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_I8 types;
When the data type of the call parameters is floating point type, the floating point values of the call parameters is set to described In the m_singleValue fields for serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_SINGLE types;
When the data type of the call parameters is ascii character string type, by the ascii character of the call parameters String copy to it is described serializing call parameters m_charBuffer fields in, and by it is described serializing call parameters m_type Field is arranged to RAT_STRING types;
When the data type of the call parameters is Unicode character string types, by the Unicode of the call parameters Character string is copied in the m_wcharBuffer fields of the serializing call parameters, and by the serializing call parameters M_type fields are arranged to RAT_WSTRING types;
When the data type of the call parameters is array type, the array element of the call parameters is set and arrives institute In the m_elementNum fields for stating serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_BLOB types;
When the data type of the call parameters is object type, the structure element of the call parameters is set and arrived In the m_elementNum fields of the serializing call parameters, and the m_type fields of the serializing call parameters are set For RAT_OBJECT types.
As an alternative embodiment, serialization unit 203, is specifically used for:
Based on the data type of the call parameters, the serializing call parameters are write in the preset field.
As an alternative embodiment, serialization unit 203, is specifically used for:
When the data type of the call parameters is non-object type, if the data type of the call parameters is non-number Set type, then sequentially add the first byte and the second byte in the preset field, and first byte is described for preserving The information in the m_type fields of call parameters is serialized, second byte is used for the parameter value for preserving the call parameters.
As an alternative embodiment, serialization unit 203, is specifically used for:
When the data type of the call parameters is object type, if the data type of the call parameters is non-array Type, then sequentially add the first byte, the 3rd byte and the second byte in the preset field, and first byte is used to protect Deposit the information in the m_type fields of the serializing call parameters, the array that the 3rd byte is used in the call parameters The number of element, second byte are used for the parameter value for preserving the call parameters.
By the Information encapsulation device in remote procedure call that the present embodiment is introduced is implementation the embodiment of the present application Device used by Information encapsulation method in one in remote procedure call, so based on described in the embodiment of the present application one The Information encapsulation method in remote procedure call, those skilled in the art can understand the present embodiment in long-range mistake The embodiment and its various change form of Information encapsulation device in journey calling, so herein for this in long-range mistake How Information encapsulation device during journey is called realizes that the method in the embodiment of the present application one is no longer discussed in detail.As long as this area institute Category technical staff implements device used by the method for Information encapsulation in the embodiment of the present application one in remote procedure call, all Belong to the scope to be protected of the application.
Technical scheme in above-mentioned the embodiment of the present application, at least has the following technical effect that or advantage:
In the embodiment of the present application, a kind of Information encapsulation device in remote procedure call is disclosed, including:It is it is determined that single Member, for call end carry out remote procedure call when, it is determined that the data knot of the recalls information for calling the remote process Structure, preset field is included in the data structure;Acquiring unit, it is used to call the calling of the remote process to join for obtaining Number;Serialization unit, for being serialized to the call parameters, obtain serializing call parameters;Writing unit, for inciting somebody to action The serializing call parameters are write in the preset field, obtain the recalls information.When carrying out remote procedure call, adopt Recalls information is obtained with this method, then recalls information is sent to the called terminal of remote process by network, can be carried significantly Information transfer efficiency during the high-altitude invocation of procedure, so as to solve in the prior art when carrying out remote procedure call, exist The low technical problem of information transfer efficiency.
Embodiment three
Based on same inventive concept, as shown in figure 3, present embodiments providing a kind of progress remote process tune in a synchronous manner Device 300, including memory 310, processor 320 and be stored on memory 310 and can run on the processor 320 Computer program 311, processor 320 realize following steps when performing the computer program 311:
When calling end to carry out remote procedure call, it is determined that the data structure of the recalls information for calling remote process, Preset field is included in data structure;Obtain the call parameters for calling remote process;Call parameters are serialized, obtained Call parameters must be serialized;Serializing call parameters are write in preset field, obtain recalls information.
In specific implementation process, when processor 320 performs computer program 311, it is possible to achieve embodiment is a kind of to appoint One embodiment, reference implementation example one, here is omitted.
Example IV
Based on same inventive concept, as shown in figure 4, a kind of computer-readable recording medium 400 is present embodiments provided, its On be stored with computer program 411, the computer program 411 realizes following steps when being executed by processor:
When calling end to carry out remote procedure call, it is determined that the data structure of the recalls information for calling remote process, Preset field is included in data structure;Obtain the call parameters for calling remote process;Call parameters are serialized, obtained Call parameters must be serialized;Serializing call parameters are write in preset field, obtain recalls information.
In specific implementation process, when the computer program 411 is executed by processor, it is possible to achieve embodiment is a kind of to appoint One embodiment, reference implementation example one, here is omitted.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware Apply the form of example.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of product.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know basic creation Property concept, then can make other change and modification to these embodiments.So appended claims be intended to be construed to include it is excellent Select embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out the essence of various changes and modification without departing from the present invention to the present invention God and scope.So, if these modifications and variations of the present invention belong to the scope of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to comprising including these changes and modification.

Claims (10)

  1. A kind of 1. Information encapsulation method in remote procedure call, it is characterised in that including:
    When calling end to carry out remote procedure call, it is determined that the data structure of the recalls information for calling the remote process, Preset field is included in the data structure;
    Obtain the call parameters for calling the remote process;
    The call parameters are serialized, obtain serializing call parameters;
    The serializing call parameters are write in the preset field, obtain the recalls information.
  2. 2. the Information encapsulation method in remote procedure call as claimed in claim 1, it is characterised in that described to the tune Serialized with parameter, obtain serializing call parameters, including:
    Determine the data type of the call parameters;
    The data type of the call parameters is converted into remote procedure call parameter IRpcArgument types, obtains the sequence Rowization call parameters.
  3. 3. the Information encapsulation method in remote procedure call as claimed in claim 1, it is characterised in that the call parameters Data type, including:
    Integer type or byte Type or floating point type or ASCII ascii character string type or uniformly Character encoding standard Unicode character string types or array type or object type.
  4. 4. the Information encapsulation method in remote procedure call as claimed in claim 3, it is characterised in that described by the tune Remote procedure call parameter IRpcArgument types are converted into the data type of parameter, including:
    When the data type of the call parameters is integer type, the integer value of the call parameters is set and arrives the sequence In the m_intValue fields for changing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_I32 Type;
    When the data type of the call parameters is byte Type, the byte value of the call parameters is set and arrives the sequence In the m_i8Value fields of rowization call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_I8 Type;
    When the data type of the call parameters is floating point type, the floating point values of the call parameters is set and arrives the sequence In the m_singleValue fields for changing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_ SINGLE types;
    When the data type of the call parameters is ascii character string type, the ascii string of the call parameters is answered Make it is described serializing call parameters m_charBuffer fields in, and by it is described serializing call parameters m_type fields It is arranged to RAT_STRING types;
    When the data type of the call parameters is Unicode character string types, by the Unicode characters of the call parameters String copy to it is described serializing call parameters m_wcharBuffer fields in, and by it is described serializing call parameters m_ Type fields are arranged to RAT_WSTRING types;
    When the data type of the call parameters is array type, the array element of the call parameters is set and arrives the sequence In the m_elementNum fields of rowization call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_ BLOB types;
    When the data type of the call parameters is object type, the structure element of the call parameters is set to described In the m_elementNum fields for serializing call parameters, and the m_type fields of the serializing call parameters are arranged to RAT_OBJECT types.
  5. 5. the Information encapsulation method in remote procedure call as described in Claims 1 to 4 is any, it is characterised in that described The serializing call parameters are write in the preset field, including:
    Based on the data type of the call parameters, the serializing call parameters are write in the preset field.
  6. 6. the Information encapsulation method in remote procedure call as claimed in claim 5, it is characterised in that call ginseng described When several data types is non-object type, the data type based on the call parameters, ginseng is called into the serializing Number is write in the preset field, including:
    If the data type of the call parameters is non-array type, sequentially added in the preset field the first byte and Second byte, first byte be used for preserve it is described serializing call parameters m_type fields in information, described second Byte is used for the parameter value for preserving the call parameters.
  7. 7. the Information encapsulation method in remote procedure call as claimed in claim 5, it is characterised in that call ginseng described When several data types is non-object type, the data type based on the call parameters, ginseng is called into the serializing Number is write in the preset field, including:
    If the data type of the call parameters is array type, the first byte, are sequentially added in the preset field Three bytes and the second byte, first byte are used to preserve the information in the m_type fields of the serializing call parameters, The number for the array element that 3rd byte is used in the call parameters, second byte are used to preserve the calling ginseng Several parameter values.
  8. A kind of 8. Information encapsulation device in remote procedure call, it is characterised in that including:
    Determining unit, for call end carry out remote procedure call when, it is determined that for calling the calling of the remote process to believe The data structure of breath, preset field is included in the data structure;
    Acquiring unit, for obtaining the call parameters for being used for calling the remote process;
    Serialization unit, for being serialized to the call parameters, obtain serializing call parameters;
    Writing unit, for the serializing call parameters to be write in the preset field, obtain the recalls information.
  9. 9. a kind of Information encapsulation device in remote procedure call, including memory, processor and storage are on a memory simultaneously The computer program that can be run on a processor, it is characterised in that realize following steps during the computing device described program:
    When calling end to carry out remote procedure call, it is determined that the data structure of the recalls information for calling the remote process, Preset field is included in the data structure;Obtain the call parameters for calling the remote process;To the call parameters Serialized, obtain serializing call parameters;The serializing call parameters are write in the preset field, described in acquisition Recalls information.
  10. 10. a kind of computer-readable recording medium, is stored thereon with computer program, it is characterised in that the program is by processor Following steps are realized during execution:
    When calling end to carry out remote procedure call, it is determined that the data structure of the recalls information for calling the remote process, Preset field is included in the data structure;Obtain the call parameters for calling the remote process;To the call parameters Serialized, obtain serializing call parameters;The serializing call parameters are write in the preset field, described in acquisition Recalls information.
CN201710524061.1A 2017-06-30 2017-06-30 Information packaging method and device in remote procedure call Active CN107483399B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710524061.1A CN107483399B (en) 2017-06-30 2017-06-30 Information packaging method and device in remote procedure call

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710524061.1A CN107483399B (en) 2017-06-30 2017-06-30 Information packaging method and device in remote procedure call

Publications (2)

Publication Number Publication Date
CN107483399A true CN107483399A (en) 2017-12-15
CN107483399B CN107483399B (en) 2020-10-16

Family

ID=60596110

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710524061.1A Active CN107483399B (en) 2017-06-30 2017-06-30 Information packaging method and device in remote procedure call

Country Status (1)

Country Link
CN (1) CN107483399B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109117209A (en) * 2018-07-23 2019-01-01 广州多益网络股份有限公司 Serializing and unserializing method and device
CN110659139A (en) * 2018-06-28 2020-01-07 武汉斗鱼网络科技有限公司 Remote procedure calling method, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2590090A1 (en) * 2011-11-03 2013-05-08 Business Objects Software Ltd. Dynamic interface to read database through remote procedure call
CN104270470A (en) * 2014-10-24 2015-01-07 杭州高达软件系统股份有限公司 Remote service invocation method, device and system
CN106357713A (en) * 2015-07-16 2017-01-25 北京京东尚科信息技术有限公司 Remote procedure call realizing method, client side device and server device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2590090A1 (en) * 2011-11-03 2013-05-08 Business Objects Software Ltd. Dynamic interface to read database through remote procedure call
CN104270470A (en) * 2014-10-24 2015-01-07 杭州高达软件系统股份有限公司 Remote service invocation method, device and system
CN106357713A (en) * 2015-07-16 2017-01-25 北京京东尚科信息技术有限公司 Remote procedure call realizing method, client side device and server device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZHANLIJUN: ""你应该知道的RPC原理"", 《HTTPS://WWW.CNBLOGS.COM/LBSER/P/4853234.HTML》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110659139A (en) * 2018-06-28 2020-01-07 武汉斗鱼网络科技有限公司 Remote procedure calling method, computer equipment and storage medium
CN109117209A (en) * 2018-07-23 2019-01-01 广州多益网络股份有限公司 Serializing and unserializing method and device
CN109117209B (en) * 2018-07-23 2021-10-01 广州多益网络股份有限公司 Serialization and deserialization method and device

Also Published As

Publication number Publication date
CN107483399B (en) 2020-10-16

Similar Documents

Publication Publication Date Title
CN108563517B (en) Calling method and device of system interface
CN105204823B (en) Generate the method and device of application program installation kit
WO2021244194A1 (en) Register reading/writing method, chip, subsystem, register group, and terminal
TW200541260A (en) System security approach methods using state tables, related computer-readable medium, and related systems
CN103067441B (en) Method, device and the equipment that a kind of picture is shared
CN110245469A (en) Watermark generation method, watermark analytic method, device and the storage medium of webpage
CN106790727A (en) Information push method and device
CN106547580A (en) The method and apparatus of hooking function
WO2020083019A1 (en) Decoding method based on multi-core processor, terminal device and storage medium
CN109960597A (en) A kind of dynamic registration method and relevant apparatus of Applied layer interface
CN107483399A (en) A kind of Information encapsulation method and device in remote procedure call
CN106339210B (en) Data processing method and relevant apparatus in a kind of web game
CN109785222A (en) A method of the information for webpage is quickly embedded in and extracts
CN106850650A (en) The method and client games system of data are accessed for game client
CN107329916A (en) A kind of USB device control method, device and computing device
CN107391272A (en) The method and terminal of multi-process data interaction
CN110069907A (en) Big data source tracing method and system based on digital watermarking
CN104679489A (en) System and method for internally setting web browser in online game client side
CN105335203B (en) The binary translation of shared library executes method and apparatus
CN108153745B (en) Application data calling method and application development system
CN105979021B (en) A kind of information processing method and user terminal
CN111330270A (en) User interface rendering method
CN105793842B (en) Conversion method and device between serialized message
CN113391811A (en) Function compiling method and device, electronic equipment and computer readable storage medium
CN108572593B (en) Cross-platform convolutional neural network control system and method and information data processing terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240102

Address after: 710000, Room 403, New Era Building, No. 9 Gaoxin Third Road, High tech Zone, Xi'an City, Shaanxi Province

Patentee after: Xi'an Crosstrust Network Technology Co.,Ltd.

Address before: 430000 East Lake Development Zone, Wuhan City, Hubei Province, No. 1 Software Park East Road 4.1 Phase B1 Building 11 Building

Patentee before: WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.