WO2020098435A1 - 一种数据报文发送和接收方法、存储介质及处理器 - Google Patents

一种数据报文发送和接收方法、存储介质及处理器 Download PDF

Info

Publication number
WO2020098435A1
WO2020098435A1 PCT/CN2019/111031 CN2019111031W WO2020098435A1 WO 2020098435 A1 WO2020098435 A1 WO 2020098435A1 CN 2019111031 W CN2019111031 W CN 2019111031W WO 2020098435 A1 WO2020098435 A1 WO 2020098435A1
Authority
WO
WIPO (PCT)
Prior art keywords
source
target
source end
information
data message
Prior art date
Application number
PCT/CN2019/111031
Other languages
English (en)
French (fr)
Inventor
刘若鹏
栾琳
郑志林
Original Assignee
杭州光启人工智能研究院
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 杭州光启人工智能研究院 filed Critical 杭州光启人工智能研究院
Publication of WO2020098435A1 publication Critical patent/WO2020098435A1/zh

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/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • 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/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Definitions

  • the present invention relates to the field of communication technologies, and in particular, to a data message sending and receiving method, a storage medium, and a processor.
  • the Internet of Things has become a trend, and network communication has become a key technology.
  • the mainstream Internet of Things network communication uses a C / S (client server) architecture.
  • the C / S structure is technically mature. Its main features are strong interactivity, a safe access mode, low network traffic, The response speed is fast, which facilitates the processing of large amounts of data.
  • the HTTP protocol has become one of the mainstream communication methods. However, multiple data interactions are required between HTTP communication devices at one time, and a large amount of data is carried at the same time.
  • the technical problem to be solved by the present invention is to provide a data message sending and receiving method, a storage medium and a processor, which can control the size of the data packet and the frequency of interaction between network communications between devices, thereby reducing the device End-use hardware uses resources, such as memory, CPU, etc., to improve device performance and reduce failure rates
  • an embodiment of the present invention provides a data packet sending method, including: a source end collecting an information group packet, where the information group packet is used to identify the source end; The source end sends the information group packet to the target end; the source end receives the unique session identifier sent by the target end and assigned to the source end according to the information pairing rule.
  • a data packet sending method including: a source end collecting an information group packet, where the information group packet is used to identify the source end; The source end sends the information group packet to the target end; the source end receives the unique session identifier sent by the target end and assigned to the source end according to the information pairing rule.
  • an embodiment of the present invention provides a storage medium, where the storage medium includes a stored program, where the above-described data message sending method is executed when the program runs.
  • an embodiment of the present invention provides a processor, where the processor is used to run a program, wherein, when the program is running, the foregoing data packet sending method is executed.
  • an embodiment of the present invention provides a data packet receiving method, including a target end receiving an information group packet sent by a source end, where the information group packet is used to identify the source end; After the information group packet, the source end is assigned a unique session identifier according to the information pairing rule; the target end sends the assigned source end unique session identifier to the source end.
  • an embodiment of the present invention provides a storage medium, where the storage medium includes a stored program, where the above-described data message receiving method is executed when the program is run.
  • an embodiment of the present invention provides a processor, where the processor is used to run a program, where the above-described data packet receiving method is executed when the program is run.
  • an embodiment of the present invention provides a data message interaction system, the system includes at least one source terminal and at least one target terminal connected through a network, wherein the source terminal includes source information storage A unit and a source-side information sending unit, the source-side information storage unit is used to store the source-side information group packet, and the source-side information sending unit is used to send the information group packet to the target side; the target The terminal includes a target-side information storage unit, a target-side data processing unit, and an information pairing rule setting unit.
  • the target-side data processing unit After receiving the information packet, the target-side data processing unit, according to the rules set by the information pairing rule setting unit, is the source The terminal allocates a unique session identifier, and sends the unique session identifier to the source terminal; the target-side information storage unit is used to store a session established locally by the target terminal according to a unique session identifier of a different source terminal Identify the mapping table.
  • an embodiment of the present invention provides a data packet interaction device, where the device includes the foregoing system.
  • the system includes at least one source terminal and at least one target terminal connected through a network, wherein the source terminal includes a source terminal information storage unit and a source terminal information transmission unit, and the source terminal information storage unit is used to store the source An information packet at the end, the source information sending unit is used to send the information packet to the target; the target includes a target information storage unit, a target data processing unit, and an information pairing rule setting unit, After receiving the information packet, the target data processing unit assigns a unique session identifier to the source according to the rules set by the information pairing rule setting unit, and Sending the unique session identifier to the source terminal; the target-side information storage unit is used to store a session identifier mapping table established locally by the target terminal according to unique session identifiers of different source terminals.
  • the above technical solution has the following advantages: It can reduce the frequency of repeated redundant data interaction, and at the same time ensure the integrity of the information field, release memory and CPU in time, improve product performance, reduce failure rate, and can be universal It is suitable for devices with frequent data interaction.
  • FIG. 1 is a flowchart of a data message sending method according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of another data packet sending method according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of still another method for sending a data message according to an embodiment of the present invention.
  • FIG. 4 is a flowchart of a data message receiving method according to an embodiment of the present invention.
  • FIG. 5 is a structural diagram of a data message interaction system according to an embodiment of the present invention.
  • FIG. 6 is a structural diagram of another data message interaction system according to an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a data message interaction device according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of another data message interaction device according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a data packet sending method according to an embodiment of the present invention. As shown in FIG. 1, the flow of the data packet sending method includes the following steps:
  • the source end collects an information group packet, where the information group packet is used to identify the source end;
  • S102 The source end sends the information group packet to a target end;
  • S103 The source end receives the unique session identifier sent by the target end to the source end according to the information pairing rule.
  • the information packet may be customized by the source, including but not limited to MAC address, device model, hardware version, software version, CPU model, and coordinate values.
  • the constituent elements of the basic information group package that identifies the source end may be increased or decreased according to the requirements of the system.
  • the source MAC address generally uniquely identifies the source; the device model is used to identify the source device model type; the hardware version is used to identify the hardware device version information used by the source; the software version is used to identify the software version information used by the source;
  • the CPU model is used to identify the type of CPU model used at the source; the coordinate value is used to identify the geographic location of the source, such as latitude and longitude. The combination of these basic information packets uniquely determines the source.
  • the source end when the source end fails to send the information group packet to the target end, the source end continues to send the information group packet to the target end, when the number of transmission failures reaches a preset number of times , It is determined that the source end is abnormal and restarts.
  • the source can customize the number of attempts to send a packet, such as 5 times, 10 times, etc.
  • a request to clear the unique session identifier of the source end is sent to the target end, and then a result of clearing the unique session identifier of the source end by the target end is received.
  • the source end may send a request to clear the current session identification to the target end when exiting normally according to the actual situation.
  • the source end may be set as a client or a server according to actual work needs.
  • two source of session identification pools are initialized when the source program starts: an allocated session identification pool and an unassigned session identification pool, respectively storing the session identification being used and the unused session identification.
  • the allocated session identification pool is empty, and the unassigned session identification pool stores all the preset session identification addresses.
  • FIG. 2 is a flowchart of another data packet sending method according to an embodiment of the present invention. Compared with FIG. 1, the difference between FIG. 2 and FIG. 1 is that: the source end further includes steps before initializing the information packet: initializing the system address, port, and environment variable data of the target end. As shown in FIG. 1, the flow of the data packet sending method includes the following steps:
  • S201 Initialize the data of the target system address, port, and environment variables
  • the source end collects an information group packet, where the information group packet is used to identify the source end;
  • S203 The source end sends the information group packet to the target end;
  • the source end receives the unique session identifier sent by the target end and assigned to the source end according to an information pairing rule.
  • the source side initializes the target system address, port, and environment variable data, and its purpose is to establish a connection with the specified target side. Establishing a connection is the primary condition for data packet interaction between the source and the target
  • FIG. 3 is a flowchart of yet another method for sending a data message according to an embodiment of the present invention.
  • Figure 3 is the specific implementation of Figure 2.
  • the flow of the data packet sending method includes the following steps:
  • S301 Initialize the target system address, port, and environment variable data
  • the source end collects an information group packet, where the information group packet is used to identify the source end;
  • the source end sends the information group packet to the target end through an HTTP protocol
  • S304 The source end receives the unique session identifier sent by the target end and assigned to the source end according to the information pairing rule.
  • HTTP Hypertext Transfer Protocol
  • HTTP is the application layer protocol, when using the Internet to browse the web, data will be transmitted between the browser and the Web server on the Internet through HTT P Sending and receiving.
  • HTTP is a stateless protocol based on the request / response model. This is what we usually call Request / Response.
  • the request line indicates H TTP request method, request address, version number;
  • the request header indicates the attribute values of the HTTP request;
  • the request data indicates the real data of the HTTP request, and this part is customized by the user.
  • the HTTP protocol uses a request response model.
  • the client sends a request message to the server.
  • the server responds with a status.
  • the source and target use HTTP communication, the target according to the source specific information (such as MAC address, device model, hardware version, software version, CPU model, coordinate value and other basic information ) Generate a unique session identifier of the current network to identify the unique source end. This operation can reduce the amount of data per packet interaction, reduce the CPU working time at both the source and target ends, and reduce the CPU workload at both the source and target ends. , Thereby improving the performance of both ends.
  • the source and target use HTTP communication, the target according to the source specific information (such as MAC address, device model, hardware version, software version, CPU model, coordinate value and other basic information )
  • the source specific information such as MAC address, device model, hardware version, software version, CPU model, coordinate value and other basic information
  • the source end may also send the information group packet through the TCP protocol to the target end.
  • the application layer represents the uppermost layer of data, which is customized by the user.
  • the function of the HTTP transport layer is to enable peer entities on the source and target hosts to have conversations, such as the TCP network layer.
  • IP host to network layer represents the interface from the physical network device to the network layer.
  • the network layer data can be modified to suit the communication method of this layer device or to Network layer protocols, such as Ethernet.
  • the target end fails to receive for the first time, and the source end reports the next report as the first report. If the definition setting is reported unsuccessfully after ten attempts, it means that the source end is abnormal and a restart operation is required.
  • the source and target use TCP communication mode, the target according to the source specific information (such as MAC address, device model, hardware version, software version, CPU model, coordinate value and other basic information ) Generate a unique session identifier for the current network to identify the unique source end. This operation can reduce the amount of data per packet interaction and reduce the CPU working time at both the source and target ends, thereby improving the performance of both ends.
  • the source specific information such as MAC address, device model, hardware version, software version, CPU model, coordinate value and other basic information
  • the source end may also send the information packet through the UDP protocol to the target end.
  • the source port represents the sender port address; the target port represents the receiver port address.
  • the length of the user data packet indicates the sum of the length of the UDP protocol header and the user data, and the checksum indicates that the user at the receiving end judges whether the data sent by the sending end is distorted or lost during transmission.
  • the target end fails to receive for the first time, and the source end reports the next report as the first report, as defined by the source end If the setting attempt is reported unsuccessfully ten times, the source end is abnormally restarted.
  • the source and target use UDP communication, the target according to the source specific information (such as MAC address, device model, hardware version, software version, CPU model, coordinate value and other basic information ) Generate a unique session identifier for the current network to identify the unique source end. This operation can reduce the amount of data per packet interaction, reduce the CPU workload on both the source and destination ends, and improve the performance of both ends.
  • the source specific information such as MAC address, device model, hardware version, software version, CPU model, coordinate value and other basic information
  • An embodiment of the present invention further provides a storage medium, the storage medium includes a stored program, wherein, when the above program runs, the above data packet sending method flow is executed.
  • the above storage medium may be set to store program code for executing the following data message sending method flow:
  • the source end collects an information group packet, where the information group packet is used to identify the source end;
  • S102 The source end sends the information group packet to a target end;
  • S103 The source end receives the unique session identifier sent by the target end and assigned to the source end according to an information pairing rule.
  • the above storage medium may include but is not limited to: a USB flash drive, a read-only memory (Read-Only Memory, ROM for short), a random access memory (Random Access Memory, hereinafter referred to as RAM), removable hard disk, magnetic disk or CD-ROM and other media that can store program code.
  • a USB flash drive a read-only memory (Read-Only Memory, ROM for short)
  • a random access memory Random Access Memory, hereinafter referred to as RAM
  • removable hard disk magnetic disk or CD-ROM and other media that can store program code.
  • Embodiment 5 [0066] An embodiment of the present invention further provides a processor, the processor is used to run a program, wherein, when the program is executed, the steps in the method for sending a data message described above are executed.
  • the source end collects an information group package, where the information group package is used to identify the source side;
  • S102 The source end sends the information group packet to a target end;
  • S103 The source end receives a unique session identifier sent by the target end and assigned to the source end according to an information pairing rule.
  • FIG. 4 is a flowchart of a data message receiving method according to an embodiment of the present invention. As shown in FIG. 4, the data message receiving method includes:
  • the target end receives an information group packet sent by the source end, where the information group packet is used to identify the source end;
  • S402 After successfully receiving the information group packet, the target end allocates a unique session identifier to the source end according to the information pairing rule;
  • S403 The target end sends the assigned unique session identifier of the source end to the source end.
  • the unique session identifier assigned by the target end to the source end according to the information pairing rule corresponds to the information packet of the source end received by the target end.
  • the method further includes: establishing a unique session identifier mapping table between the source end and the source end locally.
  • the target end performs a more standardized management of the source end device by establishing a session identification mapping table for different source ends locally.
  • the target end dynamically updates the local session identification mapping table corresponding to different source information accordingly, and the source end dynamically updates its own session identification information accordingly, so as to ensure the synchronous update of the source and target session identification information changes Ensure the accuracy and timeliness of data interaction between source and target.
  • the target end after the target end locally establishes a unique session identifier mapping table between the source end and the source end, it also includes verifying the validity of the unique session identifier of the source end.
  • the purpose of the target end to verify the validity of the unique session identifier of the source is to make full use of the session identifier value, remove the failed connection in time, make full use of the source session identifier value, and fully plan the allocated session identifier pool and The session ID pool is not assigned.
  • the target end verifies the validity of the unique session identifier of the source end refers to the target end querying the corresponding session end unique session identifier in the local session identifier mapping table, if the local session In the identifier mapping table, the unique session identifier of the source end is valid, otherwise it is invalid. For an invalid session ID, the target end actively clears the information corresponding to the invalid session ID in the local session ID mapping table, and then updates the local session ID mapping table.
  • the target end when the target end fails to receive the information packet sent from the source end, the target end feeds back a reception failure status to the source end.
  • the target end In order to maintain the transparency of communication with the source, when the target fails to receive the packet from the source, it is necessary to send the failed information to the source. In this way, the source has the opportunity to decide whether to try to connect to the target or to give up.
  • the target end when the target end receives the request for clearing the unique session identification of the source end sent by the source end, the session identification information unique to the source end in the session identification mapping table is cleared, and the The source feedback clears the status.
  • the target end clears the unique session identification information of the source end in the session identification mapping table, it is necessary to send the information of the success or failure to the source end. In this way, the source end has the opportunity to decide whether to attempt to send a request to the target end again to clear the unique session identification information of the source end in the session identification mapping table or to give up the attempt.
  • the target end starts a timer, and the timer is used to query whether the source end corresponding to all the unique session identifiers of the source end in the local session identifier mapping table is online, and if multiple queries are not online, Then, the target end actively deletes the unique session identification information corresponding to the offline source end from the session identification mapping table.
  • the target end sets a timer to periodically poll whether the source end corresponding to all the unique session IDs in the local session ID mapping table is online, you can clear Except for some "zombie" source ends that have long lost connection with the target end, this can ensure that the unique session IDs of all source ends in the local session ID mapping table are active.
  • the target end receives the information packet from the source end through the UDP protocol.
  • the source port represents the sender port address; the target port represents the receiver port address.
  • the length of the user data packet indicates the sum of the length of the UDP protocol header and the user data, and the checksum indicates that the user at the receiving end judges whether the data sent by the sending end is distorted or lost during transmission.
  • the target end receives the information group packet from the source end through the HTTP protocol.
  • the advantages of using this embodiment are:
  • the source and target use HTTP communication, and the target generates current information based on the source-specific information (such as MAC address, device model, hardware version, software version, CPU model, coordinate values, and other basic information)
  • Network unique session identifier to identify the unique source end. This operation can reduce the amount of data per packet interaction, reduce the CPU working time at both the source and target ends, and reduce the CPU workload at both the source and target ends, thereby improving Performance at both ends.
  • the target end receives the information packet from the source end through the TCP protocol.
  • the advantages of using this embodiment are:
  • the source and target use TCP communication, and the target generates current information based on the source-specific information (such as MAC address, device model, hardware version, software version, CPU model, coordinate values, and other basic information) Network unique session identification to identify the unique source end.
  • This operation can reduce the amount of data per packet interaction, reduce the CPU working time at both the source and target ends, and reduce the CPU workload at both the source and target ends, thereby improving Performance at both ends.
  • the target end may be set as a client or a server according to actual work needs.
  • the target end never receives a session identifier when it receives a request for a session identification request from the source end (for the first time to report basic information such as MAC address, device model, hardware version, software version, CPU model, coordinate value, etc.)
  • the pool takes the first session identifier address and returns it, then sets the value of this session identifier value and puts it in the assigned session identifier pool, indicating that this session identifier will not be assigned to the source again, and this session identifier will be assigned to the source
  • Basic information (such as basic information such as MAC address, device model, hardware version, software version, CPU model, coordinate value, etc.) is a mapping table, which is stored in the memory of the target side; when a request to change the source session ID is received, the operation is as applying The session identification requests are consistent, and on this basis, the original session identification is deleted from the mapping table and re-bound to the new session identification.
  • Embodiment 7 5 is a structural diagram of a data message interaction system according to an embodiment of the present invention.
  • the data message interaction system includes at least one source terminal and at least one target terminal connected through a network, wherein the source terminal includes a source information storage unit and a source information transmission unit, The source-side information storage unit is used to store the source-side information group packet, and the source-side information sending unit is used to send the information group packet to the target side; the target side includes a target-side information storage unit and a target side A data processing unit and an information pairing rule setting unit, after receiving the information packet, the target data processing unit assigns a unique session identifier to the source end according to the rules of the information pairing rule setting unit The unique session identifier is sent to the source; the target-side information storage unit is used to store a session identifier mapping table that the target establishes locally based on a unique session identifier of a different source.
  • the information group package is used to identify the source end.
  • the source-end information sending unit sends the information group packet to the target end using a communication protocol.
  • the target end receives the information packet from the source end through the communication protocol.
  • the source-end information sending unit uses the HTTP protocol to send the information packet to the target end.
  • the target end receives the information packet from the source end through the HTTP protocol.
  • the source-end information sending unit uses the TCP protocol to send the information group packet to the target end.
  • the target end receives the information packet from the source end through the TCP protocol.
  • the source-end information sending unit uses the UDP protocol to send the information group packet to the target end.
  • the target receives packets from the source through the UDP protocol.
  • two source of session identification pools are initialized when the source program starts: an allocated session identification pool and an unassigned session identification pool, which respectively store the session identification in use and the unused session identification.
  • the allocated session identification pool is empty, and the unassigned session identification pool stores all the preset session identification addresses.
  • the target When receiving the request for session identification from the source (reporting the basic information such as MAC address, device model, hardware version, software version, CPU model, coordinate value, etc.) for the first time, the target extracts the first session identification from the unassigned session identification pool The address is returned, and then the session ID value is set to a tag and placed in the assigned session ID pool, indicating that the session ID will not be assigned to the source again, and the session ID and the basic information of the source (such as MAC address, Basic information such as device model, hardware version, software version, CP U model, coordinate value, etc.) Do a mapping table and save it in the memory of the target side; When receiving the request for changing the session ID of the source, the operation is the same as applying for the session ID request. On this basis, the original conversation The identity is deleted from the mapping table and re-bound to a new session identifier.
  • the basic information such as MAC address, device model, hardware version, software version, CPU model, coordinate value, etc.
  • the source MAC address, device model, hardware version, software version, CPU model, and coordinate values are
  • the target information pairing rules can be customized as follows:
  • the source sends a request for session identification to the target
  • the first-come-first-served rule is adopted according to the form of the queue.
  • the target After the target receives the first packet, it reads the target unallocated session identification pool cache , Extract the first minimum session ID assignment, extract the session ID from the unassigned session ID pool from small to large, and then mark the session ID value, transfer it to the assigned session ID pool, and assign the session ID
  • the value is paired with the basic information of the source end; when the source end sends a request to change the session ID to the target end, the rules for allocating the session ID at the source end are consistent with the request for applying the session ID. On this basis, ensure that the newly assigned session ID value is not equal to The original session ID value.
  • the session identifier allocated by the target terminal to the source terminal is 0
  • the source MAC address is relatively unchanged.
  • the subsequent device model, hardware version, software version, CPU model, coordinate value, etc. of the source end are arbitrarily changed, when the source end establishes a connection with the target end again, Then, the changed state is sent to the target end, the target end reassigns the source end with the session ID of 1, and the value of the session ID of 1 is placed in the allocated session ID pool.
  • the old value 0 of the source session identifier is recycled to the pool of unassigned session identifiers.
  • the session ID formed at the target end is:
  • the current session ID value range is between 1 and 255 natural numbers.
  • the target establishes the following session identification mapping table locally according to the rules set by the information pairing rule setting unit:
  • the above data message interaction system may be used in, but not limited to, areas where data needs to be frequently interacted, for example, mainly used to collect wireless electromagnetic wave signals within the coverage range, and record and report the qualified electromagnetic wave signal to the server. Because the sensors of such devices are normally open and need to collect information for a long time, the amount of data is large, and it is impossible to take reporting actions for each piece of information, and the reporting frequency needs to be controlled.
  • the data message interaction system includes at least one source terminal and at least one target terminal connected through a network, where the source terminal includes a source system initialization unit, a source information storage unit, and source information A sending unit, the source-side system initialization unit is used for the source to initialize the target-side system address, port, and environment variable data, the source-side information storage unit is used to store the source-side information group packet, and the source-side information is sent The unit is used to send the information packet to the target end; the target end includes a target end information storage unit, a target end data processing unit, and an information pairing rule setting unit, and the target end data processing unit receives the information After grouping, according to the rules of the information pairing rule setting unit, assign a unique session identifier to the source end, and send the unique session identifier to the source end; the target end information storage
  • the data message interaction device includes a data message interaction system, and the data message interaction system includes at least one source terminal and at least one target terminal connected through a network, wherein the source terminal includes a source information storage unit and a source A terminal information sending unit, the source information storage unit is used to store the information packet of the source end, the source information sending unit is used to send the information packet to the target end; the target end includes a target End information storage unit, target end data processing unit and information pairing rule setting unit, after receiving the information packet, the target end data processing unit assigns a unique to the source end according to the rules of the information pairing rule setting unit And the unique session identifier is sent to the source terminal; the target-side information storage unit is used to store a session identifier mapping table established locally by the target terminal according to a unique session identifier of a different source terminal.
  • the source-end information sending unit uses a communication protocol such as HTTP, UDP, TCP protocol to send the information group packet to the target end.
  • the target end receives the information packet from the source end through HTTP, UDP and TCP protocols.
  • the source end and the target end can be terminals or server ends, respectively, and frequent data interactions are performed between the two.
  • the device includes a data message interaction system, the data message interaction system includes at least one source terminal and at least one target terminal connected through a network, wherein the source terminal includes a source system initialization unit and a source information storage unit And a source-side information sending unit, the source-side system initialization unit is used for source-side initialization of the target-side system address, port, and environment variable data, and the source-side information storage unit is used for storing the source-side information group package, the The source-side information sending unit is used to send the information group packet to the target-side; the target-side includes a target-side information storage unit, a target-side data processing unit, and an information pairing rule setting unit After receiving the information packet, the target data processing unit assigns a unique session identifier to the source according to the rules of the information pairing rule setting unit, and sends the unique session identifier to the Source end; the target end information storage unit is used to store a session identification mapping table established
  • the source information sending unit uses a communication protocol such as HTTP, UDP, TCP to send the information group packet to the target.
  • the source and target can be terminal or server respectively, and frequent data interactions are performed between the two.
  • An embodiment of the present invention further provides a storage medium, the storage medium includes a stored program, wherein the above-mentioned data message receiving method flow is executed when the above-mentioned program runs.
  • the above storage medium may be set to store program code for executing the following data message receiving method flow:
  • the target end receives an information group packet sent by the source end, where the information group packet is used to identify the source end;
  • the target end After successfully receiving the information group packet, the target end allocates a unique session identifier to the source end according to the information pairing rule;
  • S403 The target end sends the assigned unique session identifier of the source end to the source end.
  • the foregoing storage medium may include, but is not limited to: a U disk, a read-only memory
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • removable hard disk magnetic disk or optical disk and other media that can store program code.
  • An embodiment of the present invention further provides a processor, which is used to run a program, where the program executes the steps in the foregoing data packet receiving method when the program is running.
  • the target end receives an information group packet sent by the source end, where the information group packet is used to identify the source end; [0126] S402. After successfully receiving the information group packet, the target end assigns a unique session identifier to the source end according to the information pairing rule;
  • S403 The target end sends the assigned unique session identifier of the source end to the source end.
  • the use of the data message sending and receiving method, storage medium, and processor according to the present invention can reduce the frequency of repeated redundant data interactions, while ensuring the integrity of the information field, and releasing the memory and CPU in a timely manner. It can improve product performance and reduce failure rate, and can be generally applied to the field of frequent data interaction.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供了一种数据报文发送和接收的方法、存储介质及处理器,其中,该发送方法包括:源端收集信息组包,所述信息组包用于标识所述源端;所述源端向目标端发送所述信息组包;所述源端接收所述目标端发送的根据信息配对规则为所述源端分配的唯一的会话标识。采用上述技术方案,可减少重复冗余数据交互频率,同时保证信息字段的完整性,及时释放设备内存、CPU,提升产品性能,减少故障率,可普遍适用于数据交互频繁的设备。

Description

说明书 发明名称:一种数据报文发送和接收方法、 存储介质及处理器 技术领域
[0001] 本发明涉及通信技术领域, 尤其涉及一种数据报文发送和接收方法、 存储介质 及处理器。
背景技术
[0002] 随着科技的飞速发展, 物联网已成为趋势, 网络通信成为一大关键技术。 目前 主流的物联网网络通信采用 C/S (客户端服务端) 架构, C/S结构在技术上很成 熟, 它的主要特点是交互性强、 具有安全的存取模式、 网络通信量低、 响应速 度快、 利于处理大量数据。 目前 HTTP协议成为一种主流通信方式之一, 然而一 次 HTTP通信设备之间需要进行多次数据交互, 同时携带大量数据。
发明概述
技术问题
[0003] 通信设备之间交互次数频繁, 并且每一次的 HTTP交互, 由于携带源端 MAC地 址、 设备型号、 硬件版本、 软件版本、 CPU型号、 坐标值等基本信息数据, 数据 属性字段偏多, 产生大量冗余数据, 造成网络拥堵, 目标端迟迟无法接收到数 据, 请求响应延迟, 影响通信设备之间交互性能。
问题的解决方案
技术解决方案
[0004] 本发明所要解决的技术问题是提供一种数据报文发送和接收方法、 存储介质及 处理器, 能够对设备端之间网络通信的数据包大小以及交互的频率进行控制, 从而降低设备端的硬件使用资源, 如内存、 CPU等, 提高设备性能、 减少故障率
[0005] 为解决上述技术问题, 第一方面, 本发明实施例提供了一种数据报文发送方法 , 包括: 源端收集信息组包, 所述信息组包用于标识所述源端; 所述源端向目 标端发送所述信息组包; 所述源端接收所述目标端发送的根据信息配对规则为 所述源端分配的唯一的会话标识。 [0006] 第二方面, 本发明实施例提供了一种存储介质, 所述存储介质包括存储的程序 , 其中, 所述程序运行时执行上述的数据报文发送方法。
[0007] 第三方面, 本发明实施例提供了一种处理器, 所述处理器用于运行程序, 其中 , 所述程序运行时执行上述的数据报文发送方法。 第四方面, 本发明实施例提 供了一种数据报文接收方法, 包括目标端接收源端发送的信息组包, 所述信息 组包用于标识所述源端; 所述目标端成功接收所述信息组包后, 根据信息配对 规则为所述源端分配唯一的会话标识; 所述目标端将分配后的源端唯一的会话 标识发送给所述源端。
[0008] 第五方面, 本发明实施例提供了一种存储介质, 所述存储介质包括存储的程序 , 其中, 所述程序运行时执行上述的数据报文接收方法。
[0009] 第六方面, 本发明实施例提供了一种处理器, 所述处理器用于运行程序, 其中 , 所述程序运行时执行上述的数据报文接收方法。
[0010] 第七方面, 本发明实施例提供了一种数据报文交互系统, 所述系统包括通过网 络连接的至少一个源端和至少一个目标端, 其中, 所述源端包括源端信息存储 单元和源端信息发送单元, 所述源端信息存储单元用于存储所述源端的信息组 包, 所述源端信息发送单元用于向所述目标端发送所述信息组包; 所述目标端 包括目标端信息存储单元、 目标端数据处理单元和信息配对规则设置单元, 所 述目标端数据处理单元接收到所述信息组包后, 根据信息配对规则设置单元设 置的规则, 为所述源端分配一个唯一的会话标识, 且将所述唯一的会话标识发 送给所述源端; 所述目标端信息存储单元用于存储所述目标端根据不同源端唯 一的会话标识在本地建立的会话标识映射表。
[0011] 第八方面, 本发明实施例提供了一种数据报文交互装置, 所述装置包括上述系 统。 所述系统包括通过网络连接的至少一个源端和至少一个目标端, 其中, 所 述源端包括源端信息存储单元和源端信息发送单元, 所述源端信息存储单元用 于存储所述源端的信息组包, 所述源端信息发送单元用于向所述目标端发送所 述信息组包; 所述目标端包括目标端信息存储单元、 目标端数据处理单元和信 息配对规则设置单元, 所述目标端数据处理单元接收到所述信息组包后, 根据 信息配对规则设置单元设置的规则, 为所述源端分配一个唯一的会话标识, 且 将所述唯一的会话标识发送给所述源端; 所述目标端信息存储单元用于存储所 述目标端根据不同源端唯一的会话标识在本地建立的会话标识映射表。
发明的有益效果
有益效果
[0012] 与现有技术相比, 上述技术方案具有以下优点: 可减少重复冗余数据交互频率 , 同时保证信息字段的完整性, 及时释放内存、 CPU , 提升产品性能, 减少故障 率, 可普遍适用于数据交互频繁设备中。
对附图的简要说明
附图说明
[0013] 为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中所需要 使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一 些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性的前提下, 还可以根据这些附图获得其它的附图。
[0014] 图 1是本发明实施例的一种数据报文发送方法流程图。
[0015] 图 2是本发明实施例的另一种数据报文发送方法流程图。
[0016] 图 3是本发明实施例的又一种数据报文发送方法流程图。
[0017] 图 4是本发明实施例的一种数据报文接收方法流程图。
[0018] 图 5是本发明实施例的一种数据报文交互系统的结构图。
[0019] 图 6是本发明实施例的另一种数据报文交互系统的结构图。
[0020] 图 7是本发明实施例的一种数据报文交互装置的结构示意图。
[0021] 图 8是本发明实施例的另一种数据报文交互装置的结构示意图。
发明实施例
本发明的实施方式
[0022] 下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是全部 的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创造性劳 动前提下所获得的所有其它实施例, 都属于本发明保护的范围。 [0023] 实施例一
[0024] 本申请实施例一所提供的数据报文发送方法实施例可以在源端与目标端上运行, 源端与目标端可以是客户机端、 服务器端、 终端设备、 计算机终端或者类似的 运算装置。 以运行在终端设备上为例, 图 1是本发明实施例的一种数据报文发送 方法流程图。 如图 1所示, 该数据报文发送方法流程包括如下步骤:
[0025] S101、 源端收集信息组包, 所述信息组包用于标识所述源端;
[0026] S102、 所述源端向目标端发送所述信息组包;
[0027] S103、 所述源端接收所述目标端发送的根据信息配对规则为所述源端分配的唯 一的会话标识。
[0028] 具体实施时, 所述信息组包可以由源端自定义, 包括但不限于 MAC地址、 设 备型号、 硬件版本、 软件版本、 CPU型号、 坐标值。
[0029] 具体实施时, 可根据系统的需求, 增加或者减少标识源端的基本信息组包的构 成要素。 源端 MAC地址一般唯一识别源端; 设备型号用于标识源端设备型号类 型; 硬件版本用于识别源端所使用的硬件设备版本信息; 软件版本用于标识源 端所使用的软件版本信息; CPU型号用于标识源端使用的 CPU型号类型; 坐标值 用于标识源端的地理位置, 如经纬度等。 这些基本信息组包组合在一起唯一确 定了源端。
[0030] 具体实施时, 所述源端向目标端发送所述信息组包失败时, 则所述源端继续向 所述目标端发送所述信息组包, 当发送失败次数达到预设次数时, 则判断所述 源端异常进行重启操作。 源端可以自定义发送信息组包尝试次数, 如 5次, 10次 等。
[0031] 具体实施时, 所述源端正常退出时, 向所述目标端发送清除所述源端唯一的会 话标识请求, 然后接收所述目标端清除所述源端唯一的会话标识的结果。 为了 充分利用会话标识数据, 源端可根据实际情况, 正常退出时, 向所述目标端发 送清除所述当前会话标识请求。
[0032] 具体实施时, 源端可以根据实际工作需要, 设为客户端或服务器端。
[0033] 具体实施时, 源端程序启动时初始化两个会话标识池: 已分配会话标识池和未 分配会话标识池, 分别存放正在使用的会话标识及未使用的会话标识。 在初始 阶段, 已分配的会话标识池为空, 未分配的会话标识池存放所有预设置会话标 识地址。
[0034] 实施例二
[0035] 图 2是本发明实施例的另一种数据报文发送方法流程图。 图 2与图 1相比, 其区 别在于: 所述源端在收集信息组包之前还包括步骤: 初始化目标端系统地址、 端口、 环境变量数据。 如图 1所示, 该数据报文发送方法流程包括如下步骤:
[0036] S201、 初始化目标端系统地址、 端口、 环境变量数据;
[0037] S202、 源端收集信息组包, 所述信息组包用于标识所述源端;
[0038] S203、 所述源端向目标端发送所述信息组包;
[0039] S204、 所述源端接收所述目标端发送的根据信息配对规则为所述源端分配的唯 一的会话标识。
[0040] 所述源端初始化目标端系统地址、 端口、 环境变量数据, 其目的在于建立与指 定的目标端建立连接。 建立连接是源端与目标端进行数据报文交互的首要条件
[0041] 实施例三
[0042] 图 3是本发明实施例的又一种数据报文发送方法流程图。 图 3是图 2的具体实施 方式。 其作为一个优选实施例, 如图 3所示, 该数据报文发送方法流程包括如下 步骤:
[0043] S301、 初始化目标端系统地址、 端口、 环境变量数据;
[0044] S302、 源端收集信息组包, 所述信息组包用于标识所述源端;
[0045] S303、 所述源端向目标端通过 HTTP协议发送所述信息组包;
[0046] S304、 所述源端接收所述目标端发送的根据信息配对规则为所述源端分配的唯 一的会话标识。
[0047] HTTP全称是 HyperText Transfer
Protocol, BP: 超文本传输协议, 是现今在 WWW上应用最多的协议, HTTP是应 用层协议, 当使用上网浏览网页的时候, 浏览器和 Web服务器之间就会通过 HTT P在 Internet上进行数据的发送和接收。 HTTP是一个基于请求 /响应模式的、 无状 态的协议。 即我们通常所说的 Request/Response。 HTTP结构体中, 请求行表示 H TTP请求方法、 请求地址、 版本号; 请求头部表示 HTTP请求各个属性值; 请求 数据表示 HTTP请求真实数据, 此部分由用户自定义。 HTTP协议采用请求响应 模型。 客户端向服务器发送一个请求报文, 服务器以一个状态作为响应, HTTP 请求响应步骤: 客户端连接到 web服务器、 客户端向服务器发起 HTTP请求、 服 务器接收 HTTP请求并返回 HTTP响应、 释放 TCP连接。
[0048] 采用此实施例的好处是: 源端和目标端采用 HTTP通信方式, 目标端根据源端 特定信息 (如 MAC地址、 设备型号、 硬件版本、 软件版本、 CPU型号、 坐标值 等基本信息) 生成当前网络唯一会话标识以辨别唯一源端, 此操作可减少每次 报文交互的数据量大小, 减少源端和目标端两端 CPU工作时间, 减轻源端和目标 端两端 CPU工作负担, 从而提高两端的性能。
[0049] 具体实施时, 源端向目标端还可以通过 TCP协议发送所述信息组包。
[0050] TCP/IP参考模型中, 应用层表示最上层数据, 由用户自定义, 如 HTTP 传输 层的功能是使源端主机和目标端主机上的对等实体可以进行会话, 如 TCP 网络 层表示把分组发往目标网络或主机, 此为协议栈的核心, 如 IP 主机到网络层表 示物理网络设备至网络层的接口, 可将网络层数据修改为适合此层设备的通信 方式或修改为网络层协议, 如以太网。
[0051] 具体实施时, 所述源端向目标端通过 TCP协议发送所述信息组包失败时, 目标 端首次未接收成功, 源端则将下一次上报作为首次上报, 如所述源端自定义设 置尝试上报十次仍不成功, 则表示所述源端异常, 需进行重启操作。
[0052] 采用此实施例的好处是: 源端和目标端采用 TCP通信方式, 目标端根据源端特 定信息 (如 MAC地址、 设备型号、 硬件版本、 软件版本、 CPU型号、 坐标值等 基本信息) 生成当前网络唯一会话标识以辨别唯一源端, 此操作可减少每次报 文交互的数据量大小, 减少源端和目标端两端 CPU工作时间, 从而提高两端的性 能。
[0053] 具体实施时, 源端向目标端还可以通过 UDP协议发送所述信息组包。
[0054] UDP数据包结构中, 源端端口表示发送端端口地址; 目标端端口表示接收端端 口地址。 用户数据包长度表示 UDP协议头及用户数据长度和, 校验和表示接收 端用户判断发送端发送数据在传输过程中有无失真或丢包等情况。 [0055] 优选地, 所述源端向目标端通过 UDP协议发送所述信息组包失败时, 目标端首 次未接收成功, 源端则将下一次上报作为首次上报, 如所述源端自定义设置尝 试上报十次仍不成功, 则所述源端异常进行重启操作。
[0056] 采用此实施例的好处是: 源端和目标端采用 UDP通信方式, 目标端根据源端特 定信息 (如 MAC地址、 设备型号、 硬件版本、 软件版本、 CPU型号、 坐标值等 基本信息) 生成当前网络唯一会话标识以辨别唯一源端, 此操作可减少每次报 文交互的数据量大小, 减少源端和目标端两端 CPU工作负担, 从而提高两端的性 能。
[0057] 通过采用如图 1〜图 3实施例, 我们可以看出, 源端向目标端发送数据时, 在源 端与目标端首次建立通信时, 将自己的信息组包发送给目标端。 然后二者之间 进行交互时, 源端发送信息给目标端时, 每次只需要通过简短的源端会话标识 来进行识别源端, 避免了源端每次与目标端信息信息交互时重复携带源端的信 息组包, 这样就减少了源端与目标端的数据交互量, 节省了带宽, 加速了源端 与目标端的通信速度。
[0058] 实施例四
[0059] 本发明的实施例还提供了一种存储介质, 该存储介质包括存储的程序, 其中, 上述程序运行时执行上述的数据报文发送方法流程。
[0060] 可选地, 在本实施例中, 上述存储介质可以被设置为存储用于执行以下数据报 文发送方法流程的程序代码:
[0061] S101、 源端收集信息组包, 所述信息组包用于标识所述源端;
[0062] S102、 所述源端向目标端发送所述信息组包;
[0063] S103、 所述源端接收所述目标端发送的根据信息配对规则为所述源端分配的唯 一的会话标识。
[0064] 可选地, 在本实施例中, 上述存储介质可以包括但不限于: U盘、 只读存储器 (Read-Only Memory, 简称为 ROM) 、 随机存取存储器 (Random Access Memory, 简称为 RAM) 、 移动硬盘、 磁碟或者光盘等各种可以存储程序代码的 介质。
[0065] 实施例五 [0066] 本发明的实施例还提供了一种处理器, 该处理器用于运行程序, 其中, 该程序 运行时执行上述的数据报文发送方法中的步骤。
[0067] 可选地, 在本实施例中, 上述程序用于执行以下步骤:
[0068] S101、 源端收集信息组包, 所述信息组包用于标识所述源端;
[0069] S102、 所述源端向目标端发送所述信息组包;
[0070] S103、 所述源端接收所述目标端发送的根据信息配对规则为所述源端分配的唯 一的会话标识。
[0071] 可选地, 本实施例中的具体示例可以参考上述实施例及具体实施时所描述的示 例, 本实施例在此不再赘述。
[0072] 实施例六
[0073] 图 4是本发明实施例的一种数据报文接收方法流程图。 如图 4所示, 所述数据报 文接收方法包括:
[0074] S401、 目标端接收源端发送的信息组包, 所述信息组包用于标识所述源端;
[0075] S402、 所述目标端成功接收所述信息组包后, 根据信息配对规则为所述源端分 配唯一的会话标识;
[0076] S403、 所述目标端将分配后的源端唯一的会话标识发送给所述源端。
[0077] 具体实施时, 所述目标端根据信息配对规则为所述源端分配的唯一的会话标识 与所述目标端接收的所述源端的信息组包相对应。 这样做的好处是, 面对源端 大量的基础信息, 为了避免源端与目标端每次数据交互中携带这些基础信息, 在源端与目标端首次交互时, 将源端长数据基础信息转化为目标端本地易于识 别的短字节数据。 在目标端与源端后续数据交互时, 只要是来自该源端的数据 , 则在目标端数据处理时, 不再显示该源端的大量的基础信息, 只用通过目标 端信息配对规则对该源端的基础信息转换后的会话标识来表示即可。 这样就节 省了数据流量, 使得源端和目标端数据交互速度更快。
[0078] 具体实施时, 所述目标端在根据信息配对规则为所述源端分配唯一的会话标识 后, 还包括: 在本地建立所述源端与所述源端唯一的会话标识映射表。 目标端 通过在本地建立针对不同源端的会话标识映射表, 来对源端设备进行更规范的 管理。 当源端信息组包有变化时, 则其相应的源端会话标识信息也有所变化, 这样目标端也相应动态地更新本地的对应于不同源端信息的会话标识映射表, 源端也相应动态地更新自身的会话标识信息, 这样确保源端和目标端会话标识 信息变化的同步更新, 确保源端和目标端数据交互的准确性与及时性。
[0079] 具体实施时, 所述目标端在本地建立所述源端与所述源端唯一的会话标识映射 表之后, 还包括校验所述源端唯一的会话标识的有效性。 目标端对源端唯一的 会话标识的有效性检测的目的在于: 充分利用会话标识值, 对于失效的连接及 时清除, 做到源端会话标识值的充分利用, 充分规划好已分配会话标识池和未 分配会话标识池。
[0080] 具体实施时, 所述目标端校验源端唯一的会话标识的有效性指的是所述目标端 在本地会话标识映射表查询相应源端唯一的会话标识, 如果在所述本地会话标 识映射表内, 则所述源端唯一的会话标识有效,否则表示无效。 对于无效的会话 标识, 则目标端主动清除本地会话标识映射表内无效的会话标识所对应的信息 , 然后再更新本地会话标识映射表。
[0081] 具体实施时, 所述目标端在接收来自所述源端发送的所述信息组包失败时, 向 所述源端反馈接收失败状态。 为了与源端保持沟通的透明性, 目标端接收来自 源端信息组包失败时, 有必要将接收失败的信息发送给源端。 这样源端有机会 自行决定尝试再与目标端进行连接还是放弃尝试。
[0082] 具体实施时, 所述目标端接收到所述源端发送清除所述源端唯一的会话标识请 求时, 清除所述会话标识映射表中源端唯一的会话标识信息, 且向所述源端反 馈清除状态。 为了与源端保持沟通的透明性, 目标端清除会话标识映射表中源 端唯一的会话标识信息时, 有必要将清除成功与否的信息发送给源端。 这样源 端有机会自行决定尝试再向目标端发送请求清除所述会话标识映射表中源端唯 一的会话标识信息还是放弃尝试。
[0083] 具体实施时, 所述目标端开启定时器, 所述定时器用于查询本地会话标识映射 表中所有源端唯一的会话标识所对应的源端是否在线, 如果多次查询均不在线 , 则所述目标端主动从所述会话标识映射表中删除不在线源端所对应的唯一的 会话标识信息。 为了与源端保持沟通的及时性, 目标端设置定时器定时轮询本 地会话标识映射表中所有源端唯一的会话标识所对应的源端是否在线, 可以清 除一些早已经与目标端失去连接的“僵尸”源端, 这样可以确保本地会话标识映射 表中所有源端唯一的会话标识是活动的。
[0084] 具体实施时, 所述目标端通过 UDP协议接收来自所述源端的信息组包。 UDP数 据包结构中, 源端端口表示发送端端口地址; 目标端端口表示接收端端口地址 。 用户数据包长度表示 UDP协议头及用户数据长度和, 校验和表示接收端用户 判断发送端发送数据在传输过程中有无失真或丢包等情况。
[0085] 具体实施时, 所述目标端通过 HTTP协议接收来自所述源端的信息组包。 采用 此实施例的好处是: 源端和目标端采用 HTTP通信方式, 目标端根据源端特定信 息 (如 MAC地址、 设备型号、 硬件版本、 软件版本、 CPU型号、 坐标值等基本 信息) 生成当前网络唯一会话标识以辨别唯一源端, 此操作可减少每次报文交 互的数据量大小, 减少源端和目标端两端 CPU工作时间, 减轻源端和目标端两端 CPU工作负担, 从而提高两端的性能。
[0086] 具体实施时, 所述目标端通过 TCP协议接收来自所述源端的信息组包。 采用此 实施例的好处是: 源端和目标端采用 TCP通信方式, 目标端根据源端特定信息 ( 如 MAC地址、 设备型号、 硬件版本、 软件版本、 CPU型号、 坐标值等基本信息 ) 生成当前网络唯一会话标识以辨别唯一源端, 此操作可减少每次报文交互的 数据量大小, 减少源端和目标端两端 CPU工作时间, 减轻源端和目标端两端 CPU 工作负担, 从而提高两端的性能。
[0087] 具体实施时, 所述目标端可以根据实际工作需要, 设为客户端或服务器端。
[0088] 具体实施时, 目标端在接收到源端申请会话标识请求 (首次上报 MAC地址、 设备型号、 硬件版本、 软件版本、 CPU型号、 坐标值等基本信息) 时, 从未分配 的会话标识池取出第一个会话标识地址返回, 然后将此会话标识值设置标记, 放入已分配会话标识池中, 表明此会话标识将不会再次分配给源端, 并且将这 个会话标识与此源端的基本信息 (如 MAC地址、 设备型号、 硬件版本、 软件版 本、 CPU型号、 坐标值等基本信息) 做映射表, 保存在目标端的内存中; 当接收 到源端会话标识更改请求时, 操作如申请会话标识请求一致, 在此基础上将原 会话标识从映射表中删除, 重新绑定为新的会话标识。
[0089] 实施例七 [0090] 图 5是本发明实施例的一种数据报文交互系统的结构图。 如图 5所示, 所述数据 报文交互系统, 包括通过网络连接的至少一个源端和至少一个目标端, 其中, 所述源端包括源端信息存储单元和源端信息发送单元, 所述源端信息存储单元 用于存储所述源端的信息组包, 所述源端信息发送单元用于向所述目标端发送 所述信息组包; 所述目标端包括目标端信息存储单元、 目标端数据处理单元和 信息配对规则设置单元, 所述目标端数据处理单元接收到所述信息组包后, 根 据信息配对规则设置单元的规则, 为所述源端分配一个唯一的会话标识, 且将 所述唯一的会话标识发送给所述源端; 所述目标端信息存储单元用于存储所述 目标端根据不同源端唯一的会话标识在本地建立的会话标识映射表。
[0091] 具体实施时, 所述信息组包用于标识所述源端。
[0092] 具体实施时, 所述源端信息发送单元采用通信协议向目标端发送所述信息组包 。 相应地, 目标端通过通信协议接收来自源端的信息组包。
[0093] 具体实施时, 所述源端信息发送单元采用 HTTP协议向目标端发送所述信息组 包。 相应地, 目标端通过 HTTP协议接收来自源端的信息组包。
[0094] 具体实施时, 所述源端信息发送单元采用 TCP协议向目标端发送所述信息组包 。 相应地, 目标端通过 TCP协议接收来自源端的信息组包。
[0095] 具体实施时, 所述源端信息发送单元采用 UDP协议向目标端发送所述信息组包 。 相应地, 目标端通过 UDP协议接收来自源端的信息组包。
[0096] 具体实施时, 源端程序启动时初始化两个会话标识池: 已分配会话标识池和未 分配会话标识池, 分别存放正在使用的会话标识及未使用的会话标识。 在初始 阶段, 已分配的会话标识池为空, 未分配的会话标识池存放所有预设置会话标 识地址。 目标端在接收到源端申请会话标识请求 (首次上报 MAC地址、 设备型 号、 硬件版本、 软件版本、 CPU型号、 坐标值等基本信息) 时, 从未分配的会话 标识池取出第一个会话标识地址返回, 然后将此会话标识值设置标记, 放入已 分配会话标识池中, 表明此会话标识将不会再次分配给源端, 并且将这个会话 标识与此源端的基本信息 (如 MAC地址、 设备型号、 硬件版本、 软件版本、 CP U型号、 坐标值等基本信息) 做映射表, 保存在目标端的内存中; 当接收到源端 会话标识更改请求时, 操作如申请会话标识请求一致, 在此基础上将原会话标 识从映射表中删除, 重新绑定为新的会话标识。
[0097] 如源端 MAC地址、 设备型号、 硬件版本、 软件版本、 CPU型号、 坐标值分别为
Figure imgf000014_0001
[0098] 目标端信息配对规则可以自定义为:
[0099] 当源端向目标端发送申请会话标识请求时, 根据队列的形式, 采取先来先得的 规则, 目标端接收第一个信息组包后, 读取目标端未分配会话标识池缓存, 提 取第一个最小会话标识分配, 在未分配会话标识池中提取会话标识采用从小到 大的方式进行, 然后将此会话标识值作标记, 移送至已分配会话标识池中, 将 此会话标识值与源端基本信息作映射配对; 当源端向目标端发送更改会话标识 请求时, 源端分配会话标识的规则与申请会话标识请求一致, 在此基础上保证 新分配的会话标识值不等于原会话标识值。
[0100] 一般情况下,在源端数量比较少的情况下,当所述源端首次与所述目标端建立连 接且连接成功时, 所述目标端为所述源端分配的会话标识为 0 源端 MAC地址是 相对不变的, 当所述源端后续设备型号、 硬件版本、 软件版本、 CPU型号、 坐标 值等任意改变时, 在所述源端再次与所述目标端建立连接时, 则发送改变的状 态给所述目标端, 所述目标端重新给所述源端分配会话标识为 1, 则会话标识为 1的值置入已分配会话标识池。 所述源端会话标识的旧值 0被回收到未分配会话 标识池。 具体实施时,根据目标端信息配对规则配对后, 在目标端形成的会话标 识为: 根据使用场景, 由于同一目标端下源端设备有限, 目前会话标识值范围 在自然数 1-255之间。 在源端数量比较多的情况下,需要在所述目标端分别建立对 所述源端基础信息的映射关系,形成映射数据库。
[0101] 如源端设备有 5个, 其对应的目标端为 1个, 则在 5个源端都与目标端都有有效 连接时, 目标端根据信息配对规则设置单元设置的规则, 在本地建立以下会话 标识映射表:
[0102]
Figure imgf000015_0001
可选地, 上述数据报文交互系统可以但不限于应用于数据需要频繁交互的领域 , 如主要用来采集覆盖范围内无线电磁波信号, 针对采集到符合条件的电磁波 信号记录上报至服务端。 由于此类设备传感器处于常开状态, 需要长时间采集 信息, 因此数据量较多, 无法针对每一条信息采取上报动作, 需控制上报频率
[0103] 通过采用上述系统, 避免源端基础信息数据与目标端的多重交互, 节省了数据 流量, 减少了 CPU、 内存等的消耗, 使得通信双方数据交互速度快。
[0104] 实施例八
[0105] 图 6是本发明实施例的另一种数据报文交互系统的结构图。 图 6与图 5的区别在 于源端增加了源端系统初始化单元。 如图 6所示, 所述数据报文交互系统包括通 过网络连接的至少一个源端和至少一个目标端, 其中, 所述源端包括源端系统 初始化单元、 源端信息存储单元和源端信息发送单元, 所述源端系统初始化单 元用于源端初始化目标端系统地址、 端口、 环境变量数据, 所述源端信息存储 单元用于存储所述源端的信息组包, 所述源端信息发送单元用于向所述目标端 发送所述信息组包; 所述目标端包括目标端信息存储单元、 目标端数据处理单 元和信息配对规则设置单元, 所述目标端数据处理单元接收到所述信息组包后 , 根据信息配对规则设置单元的规则, 为所述源端分配一个唯一的会话标识, 且将所述唯一的会话标识发送给所述源端; 所述目标端信息存储单元用于存储 所述目标端根据不同源端唯一的会话标识在本地建立的会话标识映射表。
[0106] 通过采用上述系统, 避免源端基础信息数据的多重交互, 节省了数据流量, 减 少了 CPU、 内存等的消耗, 使得通信双方数据交互速度快, 数据报文交互系统更 加稳健。
[0107] 实施例九
[0108] 图 7是本发明实施例的一种数据报文交互装置的结构示意图。 所述数据报文交 互装置包括数据报文交互系统, 所述数据报文交互系统包括通过网络连接的至 少一个源端和至少一个目标端, 其中, 所述源端包括源端信息存储单元和源端 信息发送单元, 所述源端信息存储单元用于存储所述源端的信息组包, 所述源 端信息发送单元用于向所述目标端发送所述信息组包; 所述目标端包括目标端 信息存储单元、 目标端数据处理单元和信息配对规则设置单元, 所述目标端数 据处理单元接收到所述信息组包后, 根据信息配对规则设置单元的规则, 为所 述源端分配一个唯一的会话标识, 且将所述唯一的会话标识发送给所述源端; 所述目标端信息存储单元用于存储所述目标端根据不同源端唯一的会话标识在 本地建立的会话标识映射表。
[0109] 所述源端信息发送单元采用通信协议如 HTTP、 UDP、 TCP协议向目标端发送 所述信息组包。 相应地, 所述目标端通过 HTTP、 UDP、 TCP协议接收来自源端 的信息组包。 源端和目标端可以分别为终端或者服务器端, 二者之间进行频繁 的数据交互。
[0110] 通过采用上述设备, 避免源端基础信息数据的多重交互, 节省了数据流量, 减 少了 CPU、 内存等的消耗, 使得通信双方数据交互速度快, 数据报文交互设备性 能更好。
[0111] 实施例十
[0112] 图 8是本发明实施例的另一种数据报文交互装置的结构示意图。 所述装置包括 数据报文交互系统, 所述数据报文交互系统包括通过网络连接的至少一个源端 和至少一个目标端, 其中, 所述源端包括源端系统初始化单元、 源端信息存储 单元和源端信息发送单元, 所述源端系统初始化单元用于源端初始化目标端系 统地址、 端口、 环境变量数据, 所述源端信息存储单元用于存储所述源端的信 息组包, 所述源端信息发送单元用于向所述目标端发送所述信息组包; 所述目 标端包括目标端信息存储单元、 目标端数据处理单元和信息配对规则设置单元 , 所述目标端数据处理单元接收到所述信息组包后, 根据信息配对规则设置单 元的规则, 为所述源端分配一个唯一的会话标识, 且将所述唯一的会话标识发 送给所述源端; 所述目标端信息存储单元用于存储所述目标端根据不同源端唯 一的会话标识在本地建立的会话标识映射表。
[0113] 所述源端信息发送单元采用通信协议如 HTTP、 UDP、 TCP协议向目标端发送 所述信息组包。 源端和目标端可以分别为终端或者服务器端, 二者之间进行频 繁的数据交互。
[0114] 通过采用上述设备, 避免源端基础信息数据的多重交互, 节省了数据流量, 减 少了 CPU、 内存等的消耗, 使得通信双方数据交互速度快, 数据报文交互设备性 能更好。
[0115] 实施例十一
[0116] 本发明的实施例还提供了一种存储介质, 该存储介质包括存储的程序, 其中, 上述程序运行时执行上述的数据报文接收方法流程。
[0117] 可选地, 在本实施例中, 上述存储介质可以被设置为存储用于执行以下数据报 文接收方法流程的程序代码:
[0118] S401、 目标端接收源端发送的信息组包, 所述信息组包用于标识所述源端;
[0119] S402、 所述目标端成功接收所述信息组包后, 根据信息配对规则为所述源端分 配唯一的会话标识;
[0120] S403、 所述目标端将分配后的源端唯一的会话标识发送给所述源端。
[0121] 可选地, 在本实施例中, 上述存储介质可以包括但不限于: U盘、 只读存储器
(Read-Only Memory, 简称为 ROM) 、 随机存取存储器 (Random Access Memory, 简称为 RAM) 、 移动硬盘、 磁碟或者光盘等各种可以存储程序代码的 介质。
[0122] 实施例十二
[0123] 本发明的实施例还提供了一种处理器, 该处理器用于运行程序, 其中, 该程序 运行时执行上述的数据报文接收方法中的步骤。
[0124] 可选地, 在本实施例中, 上述程序用于执行以下步骤:
[0125] S401、 目标端接收源端发送的信息组包, 所述信息组包用于标识所述源端; [0126] S402、 所述目标端成功接收所述信息组包后, 根据信息配对规则为所述源端分 配唯一的会话标识;
[0127] S403、 所述目标端将分配后的源端唯一的会话标识发送给所述源端。
[0128] 可选地, 本实施例中的具体示例可以参考上述实施例及具体实施时所描述的示 例, 本实施例在此不再赘述。
[0129] 由上述说明可知, 使用根据本发明的数据报文发送和接收方法、 存储介质及处 理器, 可减少重复冗余数据交互频率, 同时保证信息字段的完整性, 及时释放 内存、 CPU, 提升产品性能, 减少故障率, 可普遍适用于数据交互频繁领域。 工业实用性
[0130] 以上对本发明实施例进行了详细介绍, 本文中应用了具体个例对本发明的原理 及实施方式进行了阐述, 以上实施例的说明只是用于帮助理解本发明的方法及 其核心思想; 同时, 对于本领域的一般技术人员, 依据本发明的思想, 在具体 实施方式及应用范围上均会有改变之处, 综上所述, 本说明书内容不应理解为 对本发明的限制。

Claims

权利要求书
[权利要求 1] 一种数据报文发送方法, 其特征在于, 包括:
源端收集信息组包, 所述信息组包用于标识所述源端;
所述源端向目标端发送所述信息组包;
所述源端接收所述目标端发送的根据信息配对规则为所述源端分配的 唯一的会话标识。
[权利要求 2] 根据权利要求 1所述的数据报文发送方法, 其特征在于, 所述源端在 收集信息组包之前还包括: 初始化目标端系统地址、 端口、 环境变量 数据。
[权利要求 3] 根据权利要求 1所述的数据报文发送方法, 其特征在于, 所述源端向 目标端发送所述信息组包失败时, 则所述源端继续向所述目标端发送 所述信息组包, 当发送失败次数达到预设次数时, 则判断所述源端异 常进行重启操作。
[权利要求 4] 根据权利要求 1所述的数据报文发送方法, 其特征在于, 所述源端正 常退出时, 向所述目标端发送清除所述源端唯一的会话标识请求, 然 后接收所述目标端清除所述源端唯一的会话标识的结果。
[权利要求 5] 根据权利要求 1至 4任意一项所述的数据报文发送方法, 其特征在于, 所述源端向所述目标端发送所述信息组包通过 UDP或 HTTP或 TCP协 议发送。
[权利要求 6] 根据权利要求 1至 4任意一项所述的数据报文发送方法, 其特征在于, 所述源端为客户端或服务器端。
[权利要求 7] 一种存储介质, 其特征在于, 所述存储介质包括存储的程序, 其中, 所述程序运行时执行权利要求 1至 6中任一项所述的数据报文发送方法
[权利要求 8] 一种处理器, 其特征在于, 所述处理器用于运行程序, 其中, 所述程 序运行时执行权利要求 1至 6中任一项所述的数据报文发送方法。
[权利要求 9] 一种数据报文接收方法, 其特征在于, 包括:
目标端接收源端发送的信息组包, 所述信息组包用于标识所述源端; 所述目标端成功接收所述信息组包后, 根据信息配对规则为所述源端 分配唯一的会话标识;
所述目标端将分配后的源端唯一的会话标识发送给所述源端。
[权利要求 10] 根据权利要求 9所述的数据报文接收方法, 其特征在于, 所述目标端 根据信息配对规则为所述源端分配的唯一的会话标识与所述目标端接 收的所述源端的信息组包相对应。
[权利要求 11] 根据权利要求 9所述的数据报文接收方法, 其特征在于, 所述目标端 在根据信息配对规则为所述源端分配唯一的会话标识后, 还包括: 在 本地建立所述源端与所述源端唯一的会话标识映射表。
[权利要求 12] 根据权利要求 11所述的数据报文接收方法, 其特征在于, 所述目标端 在本地建立所述源端与所述源端唯一的会话标识映射表之后, 还包括 校验所述源端唯一的会话标识的有效性。
[权利要求 13] 根据权利要求 12所述的数据报文接收方法, 其特征在于, 所述目标端 校验源端唯一的会话标识的有效性指的是所述目标端在本地会话标识 映射表查询相应源端唯一的会话标识, 如果在所述本地会话标识映射 表内, 则所述源端唯一的会话标识有效,否则表示无效。
[权利要求 14] 根据权利要求 9所述的数据报文接收方法, 其特征在于, 所述目标端 在接收来自所述源端发送的所述信息组包失败时, 向所述源端反馈接 收失败状态。
[权利要求 15] 根据权利要求 11所述的数据报文接收方法, 其特征在于, 所述目标端 接收到所述源端发送清除所述源端唯一的会话标识请求时, 清除所述 会话标识映射表中源端唯一的会话标识信息, 且向所述源端反馈清除 状态。
[权利要求 16] 根据权利要求 11所述的数据报文接收方法, 其特征在于, 所述目标端 开启定时器, 所述定时器用于查询本地会话标识映射表中所有源端唯 一的会话标识所对应的源端是否在线, 如果多次查询均不在线, 则所 述目标端主动从所述会话标识映射表中删除不在线源端所对应的唯一 的会话标识信息。
[权利要求 17] 根据权利要求 9至 16任意一项所述的数据报文接收方法, 其特征在于 , 所述目标端通过 UDP或 HTTP或 TCP协议接收来自所述源端的信息 组包。
[权利要求 18] 根据权利要求 9至 16任意一项所述的数据报文接收方法, 其特征在于 , 所述目标端为客户端或服务器端。
[权利要求 19] 一种存储介质, 其特征在于, 所述存储介质包括存储的程序, 其中, 所述程序运行时执行权利要求 9至 18中任一项所述的数据报文接收方 法。
[权利要求 20] 一种处理器, 其特征在于, 所述处理器用于运行程序, 其中, 所述程 序运行时执行权利要求 9至 18中任一项所述的数据报文接收方法。
PCT/CN2019/111031 2018-11-13 2019-10-14 一种数据报文发送和接收方法、存储介质及处理器 WO2020098435A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811349335.9 2018-11-13
CN201811349335.9A CN111181900B (zh) 2018-11-13 2018-11-13 一种数据报文发送和接收方法、存储介质及处理器

Publications (1)

Publication Number Publication Date
WO2020098435A1 true WO2020098435A1 (zh) 2020-05-22

Family

ID=70655313

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/111031 WO2020098435A1 (zh) 2018-11-13 2019-10-14 一种数据报文发送和接收方法、存储介质及处理器

Country Status (2)

Country Link
CN (1) CN111181900B (zh)
WO (1) WO2020098435A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112235830A (zh) * 2020-10-16 2021-01-15 京信通信系统(中国)有限公司 数据传输方法、装置、基站和计算机可读存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112272168A (zh) * 2020-10-14 2021-01-26 天津津航计算技术研究所 一种轻量级udp通信冗余方法
CN113132944B (zh) * 2021-04-22 2023-10-20 上海银基信息安全技术股份有限公司 多通路安全通信方法、装置、车端、设备端及介质
CN115695594B (zh) * 2023-01-03 2023-03-07 徐工汉云技术股份有限公司 物联网数据通信方法和装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005277835A (ja) * 2004-03-25 2005-10-06 Nec Access Technica Ltd データ通信の優先制御方法及び装置
CN101404606A (zh) * 2008-08-01 2009-04-08 上海顶竹通讯技术有限公司 报文的隧道封装结构以及网络隧道的管理方法
CN102833253A (zh) * 2012-08-29 2012-12-19 五八同城信息技术有限公司 建立客户端与服务器安全连接的方法及服务器
CN104917736A (zh) * 2014-03-14 2015-09-16 杭州华为企业通信技术有限公司 一种会话建立方法、终端及系统
CN106209945A (zh) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 基于多连接的数据发送方法及装置
CN106612180A (zh) * 2015-10-26 2017-05-03 阿里巴巴集团控股有限公司 实现会话标识同步的方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102394857B (zh) * 2011-06-29 2015-02-25 福建星网锐捷网络有限公司 以太网上点对点协议会话建立方法、装置及设备
CN104009961B (zh) * 2013-02-25 2018-07-13 新华三技术有限公司 一种PPPoE会话标识分配方法及设备
CN105939372B (zh) * 2015-12-24 2019-04-09 杭州迪普科技股份有限公司 一种PPPoE会话建立方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005277835A (ja) * 2004-03-25 2005-10-06 Nec Access Technica Ltd データ通信の優先制御方法及び装置
CN101404606A (zh) * 2008-08-01 2009-04-08 上海顶竹通讯技术有限公司 报文的隧道封装结构以及网络隧道的管理方法
CN102833253A (zh) * 2012-08-29 2012-12-19 五八同城信息技术有限公司 建立客户端与服务器安全连接的方法及服务器
CN104917736A (zh) * 2014-03-14 2015-09-16 杭州华为企业通信技术有限公司 一种会话建立方法、终端及系统
CN106209945A (zh) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 基于多连接的数据发送方法及装置
CN106612180A (zh) * 2015-10-26 2017-05-03 阿里巴巴集团控股有限公司 实现会话标识同步的方法及装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112235830A (zh) * 2020-10-16 2021-01-15 京信通信系统(中国)有限公司 数据传输方法、装置、基站和计算机可读存储介质
CN112235830B (zh) * 2020-10-16 2023-12-05 京信网络系统股份有限公司 数据传输方法、装置、基站和计算机可读存储介质

Also Published As

Publication number Publication date
CN111181900B (zh) 2022-04-22
CN111181900A (zh) 2020-05-19

Similar Documents

Publication Publication Date Title
WO2020098435A1 (zh) 一种数据报文发送和接收方法、存储介质及处理器
US9571382B2 (en) Method, controller, and system for processing data packet
US7929422B2 (en) Method of moving a transport connection among network hosts
US7627627B2 (en) Controlling command message flow in a network
US10313247B2 (en) System, method, and device for network load balance processing
US8583831B2 (en) Thin client discovery
US9883010B2 (en) Method, apparatus, device and system for generating DHCP snooping binding table
US20060221946A1 (en) Connection establishment on a tcp offload engine
US7971099B2 (en) Method for enabling faster recovery of client applications in the event of server failure
CN107919994B (zh) 实现网络服务双机热备的方法及服务器
JP2002271393A (ja) ネットワークシステム、サーバ、クライアント、通信方法、及び通信プログラム
CN108390950A (zh) 一种消息推送方法、装置及设备
CN107528891B (zh) 一种基于WebSocket的自动集群方法及其系统
US20150180789A1 (en) Maximum Transmission Unit negotiation method and data terminal
CN106453356B (zh) 无线网络双边加速传输方法和系统
WO2016197727A1 (zh) 一种数据传输方法及装置
US9357014B2 (en) Service-based networking
CN106612196B (zh) 获取资源的方法及装置
EP2692115B1 (en) Sctp endpoint migration
CN105262836A (zh) 服务器推送信息的方法及客户端接收推送信息的方法
EP3896927A1 (en) Packet transmission method, apparatus, and system
WO2015139390A1 (zh) 组播数据处理方法、装置、系统、发送设备及接收客户端
US20140244726A1 (en) Assignment of Point-to-Point Over Ethernet (PPPoE) Session IDs
WO2013159492A1 (zh) 信息上报与下载的方法及系统
RU2542933C1 (ru) Способ (варианты), устройство (варианты) и система управления доступом

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19884509

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19884509

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19884509

Country of ref document: EP

Kind code of ref document: A1