CN109981554B - Information processing method and system and electronic equipment - Google Patents

Information processing method and system and electronic equipment Download PDF

Info

Publication number
CN109981554B
CN109981554B CN201711471000.XA CN201711471000A CN109981554B CN 109981554 B CN109981554 B CN 109981554B CN 201711471000 A CN201711471000 A CN 201711471000A CN 109981554 B CN109981554 B CN 109981554B
Authority
CN
China
Prior art keywords
information
reading
byte
index
protocol
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.)
Active
Application number
CN201711471000.XA
Other languages
Chinese (zh)
Other versions
CN109981554A (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.)
Beijing Jingdong Qianshi Technology Co Ltd
Original Assignee
Beijing Jingdong Qianshi 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 Beijing Jingdong Qianshi Technology Co Ltd filed Critical Beijing Jingdong Qianshi Technology Co Ltd
Priority to CN201711471000.XA priority Critical patent/CN109981554B/en
Publication of CN109981554A publication Critical patent/CN109981554A/en
Application granted granted Critical
Publication of CN109981554B publication Critical patent/CN109981554B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing
    • 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/22Parsing or analysis of headers

Abstract

The present disclosure provides an information processing method for identifying information in a byte stream according to a protocol, wherein each information comprises a plurality of parts divided in a byte stream order, the method comprising, according to the protocol, reading a first part of the information from the byte stream, and upon reading a second part of the information, reading from a starting byte of the first part and saving the information in the first part, wherein the second part is adjacent to and subsequent to the first part in the byte stream order.

Description

Information processing method and system and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an information processing method, system and electronic device.
Background
With the development of communication technology, more and more communication protocols are presented to adapt to communication tasks in various scenes. Under the encapsulation of the communication protocols, information interaction can be orderly carried out among the electronic devices. However, in the course of implementing the inventive concept, the inventors found that there are at least the following problems in the prior art: during the decoding process, each piece of information is read and stored, and due to the randomness of network transmission, a critical part between two pieces of information may be lost.
Disclosure of Invention
In view of the above, the present disclosure provides an information processing method, system and electronic device.
An aspect of the present disclosure provides an information processing method for identifying information in a byte stream according to a protocol, wherein each information includes a plurality of portions divided in a byte stream order, the method including reading a first portion of the information from the byte stream according to the protocol, and reading from a start byte of the first portion and saving the information in the first portion when reading a second portion of the information, which is adjacent to and subsequent to the first portion in the byte stream order.
According to an embodiment of the disclosure, after the reading the first portion of the information from the byte stream according to the protocol, the method further comprises parsing the information of the first portion according to the protocol, and the reading from a start byte of the first portion and saving the information in the first portion while reading the second portion of the information comprises reading from a start byte of the first portion to at least beyond a last byte of the second portion and saving the information in the first portion based on the protocol and/or the parsed information.
According to an embodiment of the present disclosure, the reading, according to the protocol, the first part of the information from the byte stream includes, in a case where the first part is a beginning part of the information in order of the byte stream, establishing an array, a read index, and a write index, initializing the read index and the write index to 0, where the array is configured to receive the byte stream, obtain a byte length of the first part of the information, receive the byte stream using the array, update the write index according to the number of bytes received, and complete reading of the first part of the information when a difference between the read index and the write index is not less than the byte length of the first part.
According to an embodiment of the present disclosure, when reading the second part of the information, reading from a start byte of the first part and saving the information in the first part includes establishing a tag index and assigning a value of the tag index using a value of the read index, updating a value of the read index based on a byte length of the first part, and completing reading of the second part and saving the information in the first part when reading from the tag index is started until a difference obtained by subtracting the read index from the write index is not less than the byte length of the second part.
Another aspect of the present disclosure provides an information processing system for identifying information in a byte stream according to a protocol, wherein each information includes a plurality of portions divided in a byte stream order, the system including a first reading module for reading a first portion of the information from the byte stream according to the protocol, and a second reading module for reading from a starting byte of the first portion and storing the information in the first portion when reading a second portion of the information, wherein the second portion is adjacent to and subsequent to the first portion in the byte stream order.
According to an embodiment of the present disclosure, the system further includes a parsing module configured to parse the information of the first portion according to the protocol, and the second reading module includes a first reading sub-module configured to read from a start byte of the first portion, read to at least a last byte beyond the second portion, and save the information in the first portion based on the protocol and/or the parsed information.
According to an embodiment of the present disclosure, the first reading module includes an initialization submodule configured to establish an array, a read index, and a write index and initialize the read index and the write index to 0 when the first part is a start part of the information in a byte stream order, where the array is configured to receive a byte stream, the acquisition submodule is configured to acquire a byte length of the first part of the information, the second reading submodule is configured to receive the byte stream using the array and update the write index according to a received byte number, and the suspension submodule is configured to complete reading of the first part of the information when a difference between the read index and the write index is not smaller than the byte length of the first part.
According to an embodiment of the present disclosure, the second reading module includes a tag submodule configured to create a tag index and assign a value of the tag index to the tag index, an update submodule configured to update a value of the read index based on a byte length of the first portion, and a third reading submodule configured to start reading from the tag index until a difference between a write index and the read index is not less than the byte length of the second portion, complete reading of the second portion, and store information in the first portion.
Another aspect of the present disclosure provides an electronic device, comprising, a processor; and a memory for storing executable instructions, wherein the instructions, when executed by the processor, cause the processor to perform the method of any of the above.
Another aspect of the disclosure provides a non-volatile storage medium storing computer-executable instructions for implementing the method as described above when executed.
Another aspect of the disclosure provides a computer program comprising computer executable instructions for implementing the method as described above when executed.
According to the embodiment of the disclosure, the problem that due to the randomness of network transmission, a critical part between two pieces of information may have a risk of being lost can be at least partially solved, and therefore, the technical effect of reducing the risk of information loss in the decoding process can be achieved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
fig. 1A schematically illustrates a system architecture of an information processing method, system and electronic device according to embodiments of the present disclosure;
fig. 1B schematically shows an application scenario of an information processing method according to an embodiment of the present disclosure;
FIG. 2 schematically shows a flow chart of an information processing method according to an embodiment of the present disclosure;
FIG. 3 schematically shows a flow chart of an information processing method according to another embodiment of the present disclosure;
FIG. 4 schematically shows a flow chart for reading a first portion of the information from a byte stream, in accordance with an embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow chart for reading from the start byte of the first portion and saving information in the first portion, according to an embodiment of the disclosure;
FIG. 6 schematically shows a block diagram of an information handling system according to an embodiment of the present disclosure;
FIG. 7 schematically shows a block diagram of an information handling system according to another embodiment of the present disclosure;
FIG. 8 schematically illustrates a block diagram of a first read module according to an embodiment of the disclosure;
FIG. 9 schematically shows a block diagram of a second read module according to an embodiment of the disclosure; and
FIG. 10 schematically shows a block diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). It will be further understood by those within the art that virtually any disjunctive word and/or phrase presenting two or more alternative terms, whether in the description, claims, or drawings, should be understood to contemplate the possibilities of including one of the terms, either of the terms, or both terms. For example, the phrase "a or B" should be understood to include the possibility of "a" or "B", or "a and B".
Embodiments of the present disclosure provide an information processing method for identifying information in a byte stream according to a protocol, wherein each information includes a plurality of parts divided in a byte stream order. The method starts reading a part of the information from a previous part of the part when reading the part and temporarily does not save the part but saves the part when reading a next part. By using the method of the embodiment of the disclosure, the risk of information loss in the decoding process can be reduced.
Fig. 1A schematically illustrates an exemplary system architecture 100 to which the information processing methods, systems, and electronic devices may be applied, according to embodiments of the disclosure. It should be noted that fig. 1A is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1A, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the information processing method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the information processing apparatus provided by the embodiment of the present disclosure may be generally provided in the server 105. The information processing method provided by the embodiment of the present disclosure may also be executed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the information processing apparatus provided in the embodiment of the present disclosure may also be provided in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. The information processing method provided by the embodiment of the present disclosure may also be executed by the terminal device 101, 102, or 103. Accordingly, the information processing apparatus provided by the embodiment of the present disclosure may be generally provided in the terminal device 101, 102, or 103. The information processing method provided by the embodiment of the present disclosure may also be executed by a terminal device different from the terminal devices 101, 102, 103 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the information processing apparatus provided in the embodiments of the present disclosure may also be provided in a terminal device different from the terminal devices 101, 102, 103 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in FIG. 1A are merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 1B schematically shows an application scenario of the information processing method according to an embodiment of the present disclosure. Fig. 1B illustrates only an example of an application scenario in which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, but does not mean that the embodiments of the present disclosure may not be used in other environments or scenarios.
As shown in fig. 1B, the protocol 110 may include multiple portions 111, 112, 113. Of course, the number of the plurality of portions is only illustrative, and can be arbitrarily set according to actual needs. Each part may reserve an appropriate number of bits (bits) or bytes (bytes). For example, portion 111 of the disclosed embodiment occupies 35 bytes, portion 113 occupies 2 bytes, and the number of bytes occupied by portion 112 is defined by a field in portion 111. Each part may have different functions depending on the actual protocol definition. For example, the portion 111 of the embodiment of the present disclosure is a header (Head), in which the length of the portion 112, information of the sender and the receiver, and the like are defined. Part 112 is the Body of the message (Body) that records the data being sent. Portion 113 is a message tail (Foot) having two check bits, which may be used, for example, to check the integrity of the message. The embodiments of the present disclosure are not limited to the above, but rather, the methods provided by the embodiments of the present disclosure may be applied to various forms of protocols.
Fig. 2 schematically shows a flow chart of an information processing method according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S210 and S220.
In operation S210, a first portion of the information is read from the byte stream according to the protocol.
In operation S220, when reading the second portion of the information, the reading is started from the start byte of the first portion, and the information in the first portion is saved, wherein the second portion is adjacent to and behind the first portion in the order of the byte stream.
The method is for identifying information in a byte stream according to a protocol, wherein each information comprises a plurality of portions divided in a byte stream order.
Operations S210 and S220 are described below in conjunction with the embodiment illustrated in fig. 1B. As shown in fig. 1B, this information includes portions 111, 112, and 113. When reading and identifying a byte stream that conforms to the protocol, portions 111, 112, and 113 will be read sequentially in the byte stream order.
In operation S210, a first portion of the information is read from the byte stream according to the protocol. First, the portion 111 needs to be identified first in order, at which time the portion 111 serves as the first portion. According to the disclosed embodiment, the protocol specifying part 111 occupies 35 bytes, and therefore, according to the protocol, not less than 35 bytes are read. Here, because 35 bytes cannot necessarily be accurately obtained due to the randomness of the network, the read is set to be no less than 35 bytes here to ensure the integrity of the first portion. At this point, the content of the first portion is identified, but may choose not to be saved to memory for a while.
In operation S220, when reading the second portion of the information, the reading is started from the start byte of the first portion, and the information in the first portion is saved, wherein the second portion is adjacent to and behind the first portion in the order of the byte stream. According to the embodiment of the present disclosure, when reading a second portion adjacent to the first portion after the first portion, i.e., the portion 112, for example, the second portion occupies 10 bytes, reading will be started from the start byte of the first portion, i.e., from the start portion of the portion 111, until reading is not less than 45 bytes, which is the sum of the lengths of the first portion and the second portion. The contents of the second portion are identified and information of the first 35 bytes, i.e., the length of the first portion, is truncated and stored.
Similarly, when reading the portion 113, the operation S220 may be repeated with the portion 112 as a new first portion and the portion 113 as a new second portion. In particular, when the portion 113 is the last portion of the information, since reading ends up being on the last bit anyway, reading, recognition and saving can be performed directly without considering the problem of critical points.
When the decoding method reads two parts in the information according to the protocol, the content of the first part is stored, the integrity of the content of the first part can be ensured, and unknown risks are reduced.
Fig. 3 schematically shows a flow chart of an information processing method according to another embodiment of the present disclosure.
As shown in fig. 3, the method includes operations S210, S310, and S320. Operation S210 is similar to the previous embodiment, and is not described herein again.
In operation S310, the information of the first part is parsed according to the protocol.
In operation S320, the reading, when reading the second portion of the information, starting from the start byte of the first portion and saving the information in the first portion includes reading, based on the protocol and/or the parsed information, starting from the start byte of the first portion, reading at least the last byte beyond the second portion, and saving the information in the first portion. According to the embodiment of the present disclosure, the length of each part may be specified by the protocol or defined by fields in other preceding parts. Thus, the length of a certain portion may be determined based on the protocol and/or the parsed information.
Fig. 4 schematically shows a flow chart for reading a first part of the information from a byte stream according to an embodiment of the present disclosure.
As shown in fig. 4, the method includes operations S410, S420, S430, and S440.
In operation S410, in case that the first part is a beginning part of the information in the order of the byte stream, an array, a read index, and a write index are established, and the read index and the write index are initialized to 0, where the array is used to receive the byte stream. It should be noted that the array structure is only used as an embodiment, and those skilled in the art can make any suitable choice according to the existing data combination in the process of implementing the present invention.
In operation S420, a byte length of a first portion of the information is acquired. For example, the protocol specifying part 111 has a length of 35 bytes, which is the byte length of the first part from which the information is acquired.
In operation S430, a byte stream is received using the array, and the write index is updated according to the number of bytes received. For example, if 3 bytes are received on the first byte received, the write index is updated to 3, if 2 bytes are received on the second byte received, the write index is updated to 5, and so on, while the read index is always 0 in the process.
In operation S440, when the difference between the read index and the write index is not less than the byte length of the first portion, the reading of the first portion of the information is completed. For example, in the case that the byte length of the first portion is 35, when the write index is 34, the difference between the write index and the read index is smaller than the byte length 35 of the first portion, and the reading is continued, and if 3 bytes are read next time and the write index is updated to 37, it is determined that the difference between the write index and the read index is 37 and is not smaller than the byte length 35 of the first portion, and the reading of the first portion is completed.
Fig. 5 schematically shows a flowchart for reading from a start byte of the first portion and saving information in the first portion according to an embodiment of the disclosure.
As shown in fig. 5, the method includes operations S510, S520, and S530.
In operation S510, a tag index is established and assigned with a value of a read index. For example, in the case of the foregoing embodiment, the value of the read index is 0, and the tag index is assigned with 0, in which case the write index is 37, and both the read index and the tag index are 0.
In operation S520, a value of the read index is updated based on the byte length of the first portion. According to an embodiment of the present disclosure, the byte length of the first portion is 35, and thus the value of the read index may be updated to 35.
In operation S530, reading is started from the mark index until the difference between the write index and the read index is not less than the byte length of the second portion, the reading of the second portion is completed, and the information in the first portion is saved. According to the embodiment of the present disclosure, reading is started from the position 0 byte of the mark index, the value of the write index is reset to 0, and reading is performed in operation S430, and when the difference between the value of the write index and the read index is not less than the byte length of the second portion, that is, the difference between the write index and the read index (35) is not less than 10, that is, the write index is not less than 45, the reading of the second portion is completed.
FIG. 6 schematically shows a block diagram of an information handling system 600 according to an embodiment of the disclosure.
As shown in fig. 6, the information processing system 600 includes a first reading module 610 and a second reading module 620.
The first reading module 610, for example performing operation S210 described above with reference to fig. 2, is configured to read a first portion of the information from the byte stream according to the protocol.
The second reading module 620, for example, performs operation S22O described above with reference to fig. 2, and is configured to, when reading a second portion of the information, start reading from a start byte of the first portion, and save the information in the first portion, wherein the second portion is adjacent to and after the first portion in the byte stream order.
FIG. 7 schematically shows a block diagram of an information handling system 700 according to another embodiment of the present disclosure.
As shown in fig. 7, the information processing system 700 includes a first reading module 610, a second reading module 620, a parsing module 710, and a first reading sub-module 720.
The parsing module 710, for example, performs operation S310 described above with reference to fig. 3, for parsing the information of the first portion according to the protocol.
The first reading submodule 621, for example, performs the operation S320 described above with reference to fig. 3, and is configured to read from a start byte of the first portion, read at least a last byte of the second portion, and save information in the first portion based on the protocol and/or the parsed information.
Fig. 8 schematically illustrates a block diagram of a first read module 610 according to an embodiment of the present disclosure.
As shown in fig. 8, the first reading module 610 includes an initialization sub-module 611, an acquisition module 612, a second reading sub-module 613, and a suspension sub-module 614.
The initialization submodule 611, for example, performs operation S410 described above with reference to fig. 4, and is configured to, in a case where the first part is a start part of the information in the byte stream order, establish an array, a read index and a write index, and initialize the read index and the write index to 0, where the array is used for receiving the byte stream.
The obtaining submodule 612, for example, performs operation S420 described above with reference to fig. 4, for obtaining the byte length of the first part of the information.
The second read submodule 613, for example, performs operation S430 described above with reference to fig. 4, for receiving a byte stream using the array, and updating the write index according to the number of bytes received.
The abort submodule 614, for example performing operation S440 described above with reference to fig. 4, is configured to complete reading of the first part of the information when the difference between the read index and the write index is not smaller than the byte length of the first part.
Fig. 9 schematically illustrates a block diagram of a second read module 620 according to an embodiment of the present disclosure.
As shown in fig. 9, the second read module 620 includes a marking sub-module 611, an updating sub-module 612, and a third read sub-module 613.
The marking submodule 611, for example, performs operation S510 described above with reference to fig. 5, for establishing a marking index, and assigns a value to the marking index using a value of the read index.
The update submodule 612, for example, performs operation S520 described above with reference to fig. 5, for updating the value of the read index based on the byte length of the first portion.
The third reading sub-module 613, for example, performs operation S530 described above with reference to fig. 5, and is configured to start reading from the mark index, complete reading of the second portion until the difference between the write index and the read index is not less than the byte length of the second portion, and save the information in the first portion.
It is understood that the modules described above may be combined into one module, or any one of the modules may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the present invention, at least one of the above modules may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or in a suitable combination of three implementations of software, hardware, and firmware. Alternatively, at least one of the above modules may be implemented at least partly as a computer program module, which, when executed by a computer, may perform the functions of the respective module.
FIG. 10 schematically shows a block diagram of an electronic device according to an embodiment of the disclosure. The computer system illustrated in FIG. 10 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the disclosure.
As shown in fig. 10, a computer system 1000 according to an embodiment of the present disclosure includes a processor 1001 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1002 or a program loaded from a storage section 1008 into a Random Access Memory (RAM) 1003. Processor 1001 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 1001 may also include onboard memory for caching purposes. Processor 1001 may include a single processing unit or multiple processing units for performing different actions of the method flows described with reference to fig. 2-5 in accordance with embodiments of the present disclosure.
In the RAM 1003, various programs and data necessary for the operation of the system 1000 are stored. The processor 1001, ROM1002, and RAM 1003 are connected to each other by a bus 1004. The processor 1001 performs various operations of the method according to the embodiment of the present disclosure described above with reference to fig. 2 to 5 by executing programs in the ROM1002 and/or the RAM 1003. Note that the programs may also be stored in one or more memories other than the ROM1002 and the RAM 1003. The processor 1001 may also perform various operations of the methods according to the embodiments of the present disclosure described above with reference to fig. 2-5 by executing programs stored in the one or more memories.
System 1000 may also include an input/output (I/O) interface 1005, the input/output (I/O) interface 1005 also being connected to bus 1004, according to an embodiment of the present disclosure. The system 1000 may also include one or more of the following components connected to the I/O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 1008 including a hard disk and the like; and a communication section 1009 including a network interface card such as a LAN card, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The driver 1010 is also connected to the I/O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is mounted into the storage section 1008 as necessary.
According to an embodiment of the present disclosure, the method described above with reference to the flow chart may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication part 1009 and/or installed from the removable medium 1011. The computer program performs the above-described functions defined in the system of the embodiment of the present disclosure when executed by the processor 1001. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
It should be noted that the computer readable media shown in the present disclosure may be computer readable signal media or computer readable storage media or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer-readable signal medium may include a propagated data signal with computer-readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing. According to embodiments of the present disclosure, a computer-readable medium may include one or more memories other than the ROM1002 and/or the RAM 1003 and/or the ROM1002 and the RAM 1003 described above.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As another aspect, the present disclosure also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform: … … are provided.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. An information processing method for identifying information in a byte stream according to a protocol, wherein each information includes a plurality of parts divided in order of the byte stream, the method comprising:
reading a first portion of the information from a byte stream according to the protocol; and
and when reading the second part of the information, reading from the start byte of the first part, reading to at least the last byte exceeding the second part, and storing the information in the first part, wherein the second part is adjacent to and behind the first part in the order of the byte stream.
2. The method of claim 1, wherein,
after the reading the first portion of the information from the byte stream according to the protocol, the method further includes parsing the information of the first portion according to the protocol; and
the reading from the beginning byte of the first portion and saving the information in the first portion while reading the second portion of the information includes reading from the beginning byte of the first portion to at least beyond the last byte of the second portion based on the protocol and/or parsed information and saving the information in the first portion.
3. The method of claim 1, wherein said reading a first portion of said information from a byte stream according to said protocol comprises:
establishing an array, a read index and a write index under the condition that the first part is the initial part of the information according to the sequence of the byte stream, and initializing the read index and the write index to be 0, wherein the array is used for receiving the byte stream;
obtaining a byte length of a first portion of the information;
receiving a byte stream by using the array, and updating the write index according to the number of received bytes; and
and when the difference value of the read index and the write index is not less than the byte length of the first part, finishing reading the first part of the information.
4. The method of claim 3, wherein the reading from a starting byte of the first portion and saving information in the first portion while reading the second portion of information comprises:
establishing a mark index, and assigning a value to the mark index by using a value of a read index;
updating a value of the read index based on a byte length of the first portion; and
and starting reading from the mark index until the difference value obtained by subtracting the read index from the write index is not less than the byte length of the second part, finishing reading the second part, and storing the information in the first part.
5. An information processing system for identifying information in a byte stream according to a protocol, wherein each information comprises a plurality of portions divided in a byte stream order, the system comprising:
a first reading module for reading a first part of the information from a byte stream according to the protocol; and
and the second reading module is used for reading from the start byte of the first part when reading the second part of the information, reading to the last byte at least exceeding the second part, and storing the information in the first part, wherein the second part is adjacent to and behind the first part according to the byte stream sequence.
6. The system of claim 5, wherein,
the system also comprises an analysis module used for analyzing the information of the first part according to the protocol; and
the second reading module comprises a first reading submodule for reading from a start byte of the first part, reading to at least a last byte beyond the second part and saving information in the first part based on the protocol and/or parsed information.
7. The system of claim 5, wherein the first reading module comprises:
the initialization submodule is used for establishing an array, a read index and a write index under the condition that the first part is the initial part of the information according to the sequence of the byte stream, and initializing the read index and the write index to be 0, wherein the array is used for receiving the byte stream;
an obtaining submodule for obtaining a byte length of the first part of the information;
the second reading submodule is used for receiving the byte stream by using the array and updating the write index according to the number of the received bytes; and
and the stopping submodule is used for finishing reading the first part of the information when the difference value of the read index and the write index is not less than the byte length of the first part.
8. The system of claim 7, wherein the second reading module comprises:
the marking submodule is used for establishing a marking index and assigning a value of the marking index by using the value of the read index;
an update submodule for updating a value of the read index based on a byte length of the first portion; and
and the third reading submodule is used for starting reading from the mark index until the difference value obtained by subtracting the read index from the write index is not less than the byte length of the second part, finishing reading the second part and storing the information in the first part.
9. An electronic device, comprising:
a processor; and
a memory for storing executable instructions, wherein the instructions, when executed by the processor, cause the processor to perform the method of any of claims 1-4.
10. A computer readable medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 4.
CN201711471000.XA 2017-12-28 2017-12-28 Information processing method and system and electronic equipment Active CN109981554B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711471000.XA CN109981554B (en) 2017-12-28 2017-12-28 Information processing method and system and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711471000.XA CN109981554B (en) 2017-12-28 2017-12-28 Information processing method and system and electronic equipment

Publications (2)

Publication Number Publication Date
CN109981554A CN109981554A (en) 2019-07-05
CN109981554B true CN109981554B (en) 2021-11-02

Family

ID=67075593

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711471000.XA Active CN109981554B (en) 2017-12-28 2017-12-28 Information processing method and system and electronic equipment

Country Status (1)

Country Link
CN (1) CN109981554B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588913A (en) * 2004-08-05 2005-03-02 北京航空航天大学 Method for transmission using Mbus communication middle ware
CN101192951A (en) * 2006-11-29 2008-06-04 华为技术有限公司 Measuring method and device for utilization rate of IPv6 network link and IPv6 network router
CN101277272A (en) * 2008-05-16 2008-10-01 北京航空航天大学 Method for implementing magnanimity broadcast data warehouse-in
US7782903B2 (en) * 2008-05-14 2010-08-24 Newport Media, Inc. Hardware accelerated protocol stack
CN107395565A (en) * 2017-06-15 2017-11-24 北京机械设备研究所 Serial ports receives preprocess method under a kind of fixed length single byte form message protocol

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588913A (en) * 2004-08-05 2005-03-02 北京航空航天大学 Method for transmission using Mbus communication middle ware
CN101192951A (en) * 2006-11-29 2008-06-04 华为技术有限公司 Measuring method and device for utilization rate of IPv6 network link and IPv6 network router
US7782903B2 (en) * 2008-05-14 2010-08-24 Newport Media, Inc. Hardware accelerated protocol stack
CN101277272A (en) * 2008-05-16 2008-10-01 北京航空航天大学 Method for implementing magnanimity broadcast data warehouse-in
CN107395565A (en) * 2017-06-15 2017-11-24 北京机械设备研究所 Serial ports receives preprocess method under a kind of fixed length single byte form message protocol

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于TCPflP远程数据通信系统设计;刘晓曼;《信息化建设》;20131031;第50页 *

Also Published As

Publication number Publication date
CN109981554A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
CN109995801B (en) Message transmission method and device
CN110377440B (en) Information processing method and device
CN110007936B (en) Data processing method and device
CN109683992B (en) Method and apparatus for managing objects
US20130138782A1 (en) Tiered xml services in a content management system
CN112948138A (en) Method and device for processing message
CN111597107A (en) Information output method and device and electronic equipment
CN109981554B (en) Information processing method and system and electronic equipment
CN110830427A (en) Method and device for message encoding and message decoding in netty environment
CN113127561B (en) Method and device for generating service single number, electronic equipment and storage medium
CN113760483A (en) Method and device for executing task
CN110896391A (en) Message processing method and device
CN113760487A (en) Service processing method and device
CN113760274A (en) Front-end component logic injection method and device
CN110858240A (en) Front-end module loading method and device
CN112131287A (en) Method and device for reading data
CN110647327A (en) Method and device for dynamic control of user interface based on card
CN113132480B (en) Data transmission method, device and system
CN111209014A (en) Parameter checking method and device
CN115225586B (en) Data packet transmitting method, device, equipment and computer readable storage medium
CN112860268B (en) Method and device for hot deployment of templates
CN111460269B (en) Information pushing method and device
CN113283991A (en) Processing method and device for transaction data on block chain
CN113779078A (en) Cache data acquisition method and device
CN113778350A (en) Log printing method and device

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210305

Address after: 101, 1st floor, building 2, yard 20, Suzhou street, Haidian District, Beijing 100080

Applicant after: Beijing Jingbangda Trading Co.,Ltd.

Address before: 100195 West Section 1-4 Floor 1-4 Floor West Section of 11C Building, West Section, West Section, West Section, West Section, West Section, West Section, West Section, West Section, Xiongshikou Road, Haidian District, Beijing

Applicant before: BEIJING JINGDONG SHANGKE INFORMATION TECHNOLOGY Co.,Ltd.

Applicant before: BEIJING JINGDONG CENTURY TRADING Co.,Ltd.

Effective date of registration: 20210305

Address after: Room a1905, 19 / F, building 2, No. 18, Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Beijing Jingdong Qianshi Technology Co.,Ltd.

Address before: 101, 1st floor, building 2, yard 20, Suzhou street, Haidian District, Beijing 100080

Applicant before: Beijing Jingbangda Trading Co.,Ltd.

GR01 Patent grant
GR01 Patent grant