CN117155986A - Message transmission method, system and device based on CoAP extension protocol - Google Patents

Message transmission method, system and device based on CoAP extension protocol Download PDF

Info

Publication number
CN117155986A
CN117155986A CN202310889271.6A CN202310889271A CN117155986A CN 117155986 A CN117155986 A CN 117155986A CN 202310889271 A CN202310889271 A CN 202310889271A CN 117155986 A CN117155986 A CN 117155986A
Authority
CN
China
Prior art keywords
client
message transmission
server
response
coap
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.)
Pending
Application number
CN202310889271.6A
Other languages
Chinese (zh)
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.)
Hangzhou Yunjian Technology Service Co ltd
Original Assignee
Hangzhou Yunjian Technology Service 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 Hangzhou Yunjian Technology Service Co ltd filed Critical Hangzhou Yunjian Technology Service Co ltd
Priority to CN202310889271.6A priority Critical patent/CN117155986A/en
Publication of CN117155986A publication Critical patent/CN117155986A/en
Pending legal-status Critical Current

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/14Session management
    • H04L67/141Setup of application sessions
    • 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/143Termination or inactivation of sessions, e.g. event-controlled end of session

Abstract

The application relates to a message transmission method based on a CoAP extension protocol, which is applied to a message transmission system based on the CoAP extension protocol, wherein the message transmission system comprises a client and a server, and the message transmission method suitable for the client comprises the following steps: generating a client request; creating a client session according to the client request; sending a client request to a server, wherein the client request carries a unique identifier; receiving a confirmation response and a target response of the server; upon completion of the message transmission, the client session is released. The application solves the problem that larger message transmission can not be carried out when the message asynchronous transmission is carried out based on the CoAP protocol in the related technology, and improves the availability of the message asynchronous transmission based on the CoAP protocol.

Description

Message transmission method, system and device based on CoAP extension protocol
Technical Field
The application relates to the field of communication application of the Internet of things, in particular to a message transmission method, a message transmission system and a message transmission device based on a CoAP extension protocol.
Background
CoAP (Costrained Application Protocol, limited application transport protocol) is a Web-like protocol of the world of things, an application layer protocol running over UDP. The CoAP adopts a Request/Response mode to communicate, the whole design references the HTTP protocol, and the protocol packet format is greatly simplified, so that the method is suitable for small-sized Internet of things equipment with limited resources.
In the transmission process of the CoAP protocol, when the server cannot respond to the client request in time, the transmission (Separate Response) can be generally performed in an asynchronous mode: after receiving the request from the client, the server replies a confirmation message (Acknowledgement Message), so as to prevent the client from retransmitting the request message for message loss by mistake during the waiting period of the client, and the server waits for the preparation of the resource to be completed and then sends the response content to the client. Because asynchronous transmission cannot be blocked during message transmission due to the current mechanism problem of the protocol, the message size is limited to MTU (Maximum Transmission Unit), and larger messages cannot be transmitted.
Aiming at the problem that larger message transmission can not be carried out when the message asynchronous transmission based on the CoAP protocol exists in the related technology, no effective solution is proposed at present.
Disclosure of Invention
In this embodiment, a method, a system and a device for transmitting a message based on a CoAP extension protocol are provided, so as to solve the problem that larger message transmission cannot be performed when the message is transmitted asynchronously based on the CoAP protocol in the related art.
In a first aspect, in this embodiment, a method for transmitting a message based on a CoAP extension protocol is provided, which is applied to a message transmission system based on the CoAP extension protocol, where the message transmission system includes a client and a server, and the method for transmitting a message is applicable to the client, and the method for transmitting a message includes:
generating a client request; creating a client session according to the client request;
sending the client request to a server, wherein the client request carries a unique identifier; the unique identification is transmitted by the client request for a plurality of times, and the unique identification is transmitted in the same client session;
receiving the confirmation response and the target response of the server;
and releasing the client session when the message transmission is completed.
In some embodiments, after receiving the acknowledgement response of the server, the method further includes:
according to the confirmation response, canceling a message retransmission mechanism;
setting a waiting timeout time for receiving the target response.
In some embodiments, after setting the wait timeout period according to the acknowledgement response, the method further includes:
and destroying the client session when the target response is not received within the waiting timeout time, and notifying a user that the client request fails.
In a second aspect, in this embodiment, a method for transmitting a message based on a CoAP extension protocol is provided, which is applied to a message transmission system based on the CoAP extension protocol, where the message transmission system includes a client and a server, and the method for transmitting a message is applicable to the server, and the method for transmitting a message includes:
when a client request is acquired, a server session is created;
generating a confirmation response according to the client request, wherein the confirmation response carries a unique identifier; the multiple acknowledgement response transmissions with the same unique identification are all performed in the same server session; setting a temporary option in the acknowledgement response based on the CoAP extension protocol; sending the confirmation response to the client;
generating a target response when the server resource is ready; setting a message blocking option in the target response based on the CoAP extension protocol; sending the target response to the client;
and releasing the server session when the message transmission is completed.
In some of these embodiments, the generating the target response when the resource is ready includes:
the message ID of the target response is the same as the message ID of the acknowledge response.
In some embodiments, after the sending the acknowledgement response to the client, the method further includes:
retransmitting the confirmation response when the client session of the client has been destroyed;
and destroying the server session when the retransmission times reach a preset retransmission threshold.
In some of these embodiments, the message blocking options include a message length option and a transmission process control option.
In a third aspect, in this embodiment, there is provided a CoAP extension protocol-based message transmission apparatus, which is applied to a CoAP extension protocol-based message transmission system, where the message transmission system includes a client and a server, and the message transmission apparatus is applicable to the client, and the message transmission apparatus includes:
the request generation module is used for generating a client request; creating a client session according to the client request;
the request sending module is used for sending the client request to the server, wherein the client request carries a unique identifier; the unique identification is transmitted by the client request for a plurality of times, and the unique identification is transmitted in the same client session;
the response receiving module is used for receiving the confirmation response of the server; receiving a target response of the server;
and the first session releasing module is used for releasing the client session when the message transmission is completed.
In a fourth aspect, in this embodiment, there is provided a CoAP extension protocol-based message transmission device, which is applied to a CoAP extension protocol-based message transmission system, where the message transmission system includes a client and a server, and the message transmission device is adapted to the server, and the message transmission device includes:
the response generation module is used for creating a server session when the client request is acquired; generating a confirmation response according to the client request, wherein the confirmation response carries a unique identifier; the multiple acknowledgement response transmissions with the same unique identification are all performed in the same server session; setting a temporary option in the acknowledgement response based on the CoAP extension protocol; generating a target response when the server resource is ready; setting a message blocking option in the target response based on the CoAP extension protocol;
the response sending module is used for sending the confirmation response to the client; sending the target response to the client;
and the second session releasing module is used for releasing the server session when the message transmission is completed.
In a fifth aspect, in this embodiment, there is provided a computer device, including a memory and a processor, where the memory stores a computer program, and the processor is configured to execute the computer program to perform the CoAP extension protocol-based message transmission method described in the first aspect, or the CoAP extension protocol-based message transmission method described in the second aspect.
Compared with the related art, the message transmission method, the system, the electronic device and the storage medium based on the CoAP extension protocol provided in the embodiment generate a client request at a client side; creating a client session according to the client request; sending a client request to a server, wherein the client request carries a unique identifier; the method comprises the steps that multiple client request transmissions with the same unique identification are carried out in the same client session; receiving a confirmation response and a target response of the server; releasing the client session when the message transmission is completed, or creating the server session when the client request is acquired at the server side; generating a confirmation response according to the client request, wherein the confirmation response carries a unique identifier; the multiple confirmation response transmissions with the same unique identification are all carried out in the same server session; setting a temporary option in the acknowledgement response based on the CoAP extension protocol; transmitting a confirmation response to the client; generating a target response when the server resource is ready; setting a message blocking option in a target response based on a CoAP extension protocol; sending the target response to the client; when the message transmission is completed, the server session is released, the problem that larger message transmission cannot be performed when the message asynchronous transmission is performed based on the CoAP protocol in the related technology is solved, and the availability of the message asynchronous transmission based on the CoAP protocol is improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the other features, objects, and advantages of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 is a hardware configuration block diagram of a terminal of a CoAP extension protocol-based message transmission method of the present embodiment;
fig. 2 is a flowchart of a message transmission method based on CoAP extension protocol at the client side of the present embodiment;
fig. 3 is a flowchart of a message transmission method based on CoAP extension protocol at the server side of the present embodiment;
FIG. 4 is a flow chart of the message transmission method based on the CoAP extension protocol of the preferred embodiment;
fig. 5 is a block diagram of a message transmission apparatus based on CoAP extension protocol at the client side of the present embodiment;
fig. 6 is a block diagram of the structure of a CoAP extension protocol-based message transmission apparatus on the service side of the present embodiment.
In the figure: 102. a processor; 104. a memory; 106. a transmission device; 108. an input-output device; 10. a request generation module; 20. a request sending module; 30. a response receiving module; 40. a first session release module; 50. a response generation module; 60. a response transmitting module; 70. and a second session release module.
Detailed Description
The present application will be described and illustrated with reference to the accompanying drawings and examples for a clearer understanding of the objects, technical solutions and advantages of the present application.
Unless defined otherwise, technical or scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terms "a," "an," "the," "these" and similar terms in this application are not intended to be limiting in number, but may be singular or plural. The terms "comprising," "including," "having," and any variations thereof, as used herein, are intended to encompass non-exclusive inclusion; for example, a process, method, and system, article, or apparatus that comprises a list of steps or modules (units) is not limited to the list of steps or modules (units), but may include other steps or modules (units) not listed or inherent to such process, method, article, or apparatus. The terms "connected," "coupled," and the like in this disclosure are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as used herein means two or more. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., "a and/or B" may mean: a exists alone, A and B exist together, and B exists alone. Typically, the character "/" indicates that the associated object is an "or" relationship. The terms "first," "second," "third," and the like, as referred to in this disclosure, merely distinguish similar objects and do not represent a particular ordering for objects.
The method embodiments provided in the present embodiment may be performed in a terminal, a computer, or similar computer devices. For example, the method runs on the terminal, fig. 1 is a block diagram of the hardware structure of the terminal based on the CoAP extension protocol message transmission method of the present embodiment. As shown in fig. 1, the terminal may include one or more (only one is shown in fig. 1) processors 102 and a memory 104 for storing data, wherein the processors 102 may include, but are not limited to, a microprocessor MCU, a programmable logic device FPGA, or the like. The terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and is not intended to limit the structure of the terminal. For example, the terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a message transmission method of the CoAP extension protocol in the present embodiment, and the processor 102 executes the computer program stored in the memory 104, thereby performing various functional applications and data processing, that is, implementing the above-described method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. The network includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
The following embodiments are all applicable to a CoAP extension protocol-based message transmission system, and the message transmission system specifically comprises a client and a server, wherein the client is specifically used for generating a client request and sending the client request to the server, and receiving a server response to realize message transmission; the server is used for receiving the client request, preparing server resources according to the client request, generating a server response and sending the server response to the client, so that message transmission is realized.
Example 1
In this embodiment, a method for transmitting a CoAP extension protocol message is provided, which is applied to a CoAP extension protocol-based message transmission system, where the message transmission system includes a client and a server, the method for transmitting a message is applicable to the client, and fig. 2 is a flowchart of the CoAP extension protocol-based message transmission method on the client in this embodiment, and as shown in fig. 2, the flowchart includes the following steps:
step S201, generating a client request; a client session is created based on the client request.
Step S202, a client request is sent to a server, wherein the client request carries a unique identifier; wherein, the client request transmissions with the same unique identification are all carried out in the same client session.
Step S203, receiving the confirmation response and the target response of the server.
Step S204, when the message transmission is completed, the client session is released.
Specifically, when a client prepares to generate a client request, the client creates a client session, generates Token as a unique identifier of the client session, wherein the Token is a randomly generated character string, and stores the Token in a Cookie of the client request as an identity Token of the client request; when a client request is sent to a server, the client request carries a Token, so that the same multiple client requests of the subsequent Token can be ensured to be carried out in the same client session; after the client sends the client request, the client receives a confirmation response of the server, wherein the confirmation response is a temporary confirmation, which indicates that the server has received the client request, but the server resource is not ready, and after the server resource is ready, the client receives a target response which is sent by the server and carries the server resource; when the message transmission is completed, the client session is closed.
In the steps, the unique identifier is carried in the client request, so that the unified attribution of the interactive message in the client request process to the client session management is ensured, and the reliability of message transmission is ensured; the client receives the confirmation response of the server first and then receives the target response of the server, so that asynchronous transmission of the message is realized, and the data transmission efficiency is improved.
In some embodiments, after receiving the acknowledgement response from the server, the method further includes the following steps:
step S301, cancelling the message retransmission mechanism according to the acknowledgement response.
Step S302, a waiting timeout time for receiving the target response is set.
Specifically, when the confirmation response received by the client carries a temporary option, the message retransmission mechanism is canceled, wherein the confirmation response carrying the temporary option represents the temporary confirmation of the server, namely the server has received the client request, but the server resource requested by the client is not ready; the waiting timeout time for receiving the target response is set, so that the problem that the response of the server is not received for a long time after the client sends the client request is solved, and compared with a traditional message retransmission mechanism, the transmission efficiency of message transmission is improved.
In some of these embodiments, after setting the wait timeout period based on the acknowledgement response, further comprising:
step S401, destroying the client session and notifying the user that the client request fails when the target response is not received within the waiting timeout.
Specifically, when the customer service end does not receive the target response of the server end within the waiting timeout time, the client end destroys the client session, the message transmission flow is ended, and the upper layer user client end is informed of the failure of requesting the server end resource.
Example two
In this embodiment, a method for transmitting a CoAP extension protocol message is provided, which is applied to a CoAP extension protocol-based message transmission system, where the message transmission system includes a client and a server, the method for transmitting a message is applicable to the server, and fig. 3 is a flowchart of the CoAP extension protocol-based message transmission method on the server, as shown in fig. 3, where the flowchart includes the following steps:
in step S501, when a client request is acquired, a server session is created.
Step S502, generating a confirmation response according to the client request, wherein the confirmation response carries a unique identifier; the method comprises the steps of receiving a plurality of acknowledgement response transmissions with the same unique identification, wherein the acknowledgement response transmissions with the same unique identification are all carried out in the same server session; setting a temporary option in the acknowledgement response based on the CoAP extension protocol; and sending the confirmation response to the client.
Step S503, when the server resource is ready, generating a target response; setting a message blocking option in a target response based on a CoAP extension protocol; and sending the target response to the client.
Step S504, when the message transmission is completed, releasing the server session.
Specifically, when the server side obtains the client side request, a server side session is created, and a confirmation response is generated according to the client side request, wherein the confirmation response is the same as the confirmation response concept of the server side in the first embodiment, namely, the confirmation response is temporary confirmation, which means that the server side has received the client side request, but the server side resource is not ready at the moment; the confirmation response carries a unique identifier which is the same as the unique identifier in the first embodiment and is also Token, and the confirmation response transmission for ensuring that the same multiple times of confirmation response transmission of the unique identifier is carried out in the same server session; based on the CoAP extension protocol, setting a temporary option in the acknowledgement response, wherein the CoAP extension protocol specifically comprises the following steps: adding a Temporary option on the basis of the existing CoAP protocol, wherein the Temporary option is used for sending the confirmation response with the set Temporary option to the client according to the confirmation response cancellation message retransmission mechanism and the set waiting timeout time of the target response after the subsequent client receives the confirmation response carrying the Temporary option;
through the steps, when the server resource is ready, generating a target response; based on the CoAP extension protocol, a message blocking option is set in the target response for blocking the transmission data, so that the problem of size limitation of the asynchronous transmission message in the prior art is solved, and the availability of asynchronous transmission of the message based on the CoAP protocol is improved.
In some of these embodiments, when a resource is ready, a target response is generated, comprising the steps of:
in step S601, the message ID of the target response is the same as the message ID of the acknowledgement response.
Specifically, after the server resource is ready, the generated message ID of the first label response is the same as the last acknowledgement response message ID, where the message ID (MessageID) is used for data transmission, and it should be noted that the message ID of the client request generated by the subsequent client is a new message ID, and the accuracy of data transmission is ensured by marking the client request message or the server response message by using the message ID.
In some of these embodiments, after sending the acknowledgement response to the client, the method further comprises the steps of:
in step S701, when the client session of the client has been destroyed, the acknowledgement response is retransmitted.
In step S702, when the number of retransmissions reaches a preset retransmission threshold, the server session is destroyed.
Specifically, in the process that the server waits for the resource ready, when the client session is destroyed due to waiting timeout and other reasons, the server cannot obtain the subsequent request message of the client, and retransmits the current response message according to the CoAP extension protocol, until the retransmission times reach the preset retransmission threshold value, the server session is destroyed, and the stability of message transmission is ensured when the client session is destroyed through the steps.
In some of these embodiments, the message blocking options include a message length option and a transmission process control option.
Specifically, the server adds a message blocking option in the protocol header when giving the response message, wherein the message blocking option comprises a message length option and a transmission process option. The message length option is used for specifying the total length of the message; transmission process control options are used to transmit process control, typically in BLOCK2: NUM/M/SZX, wherein NUM is a block number, and represents the number of the current block in the transmission process; m is whether a subsequent block exists or not, the value of M is 1, the subsequent block exists, and the value of M is 0, and no subsequent block exists; SZX is the block size, representing the current transport block size. It should be noted that, the transmission procedure option may be used in the server side response message or the client side request, where the M field is meaningless, NUM indicates the block number requested to be sent, and SZX indicates the block size desired to be used, which is used only as control in the client side request message. The effectiveness of the block transmission of the message is ensured through the message length option and the transmission process control option.
Example III
The present embodiment is described and illustrated below by way of preferred embodiments.
Fig. 4 is a flowchart of a message transmission method based on CoAP extension protocol of the preferred embodiment, as shown in fig. 4, the method includes the following steps:
in step S801, the client creates a client session with Token value e23fd.
In step S802, the client sends a client request to the server, where the message ID of the client request is 1234 and the token value is e23fd.
In step S803, the server creates a server session with Token value e23fd.
In step S804, the server generates and transmits a confirmation response to the client, where the message ID of the confirmation response is 1234, token is e23fd, and the server prepares the resource.
In step S805, after the server resource is ready, the server generates and transmits a target response value client, where Token is e23fd, message ID is 1234, and the transmission process control options are: 2:0/1/128, indicating that in the BLOCK partition option, the BLOCK number BLOCK is 0, the expected data BLOCK is 1, and the data BLOCK size is 128 bytes.
Step S806, after receiving the target response of the server, the client sends a client request, where the message ID of the client request is 1235, token is e23fd, and the transmission procedure port control options are: 2:1/0/128, which indicates that in the BLOCK partition option, the partition number is 1 and the data BLOCK size is 128 bytes.
In step S807, the server generates and transmits a target response value client, where the message ID of the target response is 1235, token is e23fd, and the input procedure port control options are: 2:1/1/128, which means that in the BLOCK partition option, the partition number is 1, the expected data BLOCK is 1, and the data BLOCK size is 128 bytes.
Step S808, after receiving the target response of the server, the subsequent client sends a client request, where the message ID of the client request is 1244, token is e23fd, and the transmission procedure port control options are: 2:10/0/128, which indicates that in the BLOCK partition option, the partition number is 10, and the data BLOCK size is 128 bytes.
In step S809, the server generates and sends a target response value client, where the message ID of the target response is 1244, token is e23fd, and the input procedure port control options are: 2:10/1/128, which indicates that in the BLOCK partition option, the partition number is 10, the expected data BLOCK is 1, and the data BLOCK size is 128 bytes.
Step S810, after receiving the target response of the server, the subsequent client sends a client request, where the message ID of the client request is 1245, token is e23fd, and the transmission procedure port control options are: 2:11/0/128, which indicates that in the BLOCK partition option, the partition number is 11, and the data BLOCK size is 128 bytes.
In step S811, the server generates and sends a target response value client, where the message ID of the target response is 1245, token is e23fd, and the input procedure port control options are: 2:11/1/128, indicating that in the BLOCK partition option, the partition number is 11, the expected data BLOCK is 1, and the data BLOCK size is 128 bytes.
Step S812, when the data transmission is completed, the client releases the client session with Token as e23 fd; the server releases the server session with Token e23fd.
It should be noted that the steps illustrated in the above-described flow or flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order other than that illustrated herein.
Example IV
Fig. 5 is a block diagram of a message transmission device based on CoAP extension protocol on the client side of the present embodiment, which is applied to a message transmission system based on CoAP extension protocol, the message transmission system includes a client and a server, the message transmission device is applicable to the client side, as shown in fig. 5, and the device includes: a request generation module 10, a request transmission module 20, a response reception module 30 and a first session release module 40, wherein:
a request generation module 10, configured to generate a client request; creating a client session according to the client request;
the request sending module 20 is configured to send a client request to the server, where the client request carries a unique identifier; the method comprises the steps that multiple client request transmissions with the same unique identification are carried out in the same client session;
a response receiving module 30, configured to receive an acknowledgement response from the server; receiving a target response of the server;
a first session release module 40 for releasing the client session when the message transmission is completed.
By the device, the problem that larger message transmission cannot be performed when the message is transmitted asynchronously based on the CoAP protocol in the related technology is solved, and the availability of the message transmission asynchronously based on the CoAP protocol is improved.
In some of these embodiments, the response receiving module 30 is further configured to cancel the message retransmission mechanism according to the acknowledgement response; a wait timeout time for receiving the target response is set.
In some of these embodiments, the response receiving module 30 is further configured to destroy the client session and notify the user that the client request fails when the target response is not received within the waiting timeout.
Example five
Fig. 6 is a block diagram of a message transmission device based on CoAP extension protocol on the server side of the present embodiment, which is applied to a message transmission system based on CoAP extension protocol, the message transmission system includes a client and a server, the message transmission device is applicable to the server side, as shown in fig. 6, and the device includes: a response generation module 50, a response transmission module 60, a second session release module 70, wherein:
a response generation module 50, configured to create a server session when a client request is acquired; generating a confirmation response according to the client request, wherein the confirmation response carries a unique identifier; the method comprises the steps of receiving a plurality of acknowledgement response transmissions with the same unique identification, wherein the acknowledgement response transmissions with the same unique identification are all carried out in the same server session; setting a temporary option in the acknowledgement response based on the CoAP extension protocol; generating a target response when the server resource is ready; setting a message blocking option in a target response based on a CoAP extension protocol;
a response transmitting module 60 for transmitting the confirmation response to the client; sending the target response to the client;
a second session releasing module 70, configured to release the server session when the message transmission is completed.
By the device, the problem that larger message transmission cannot be performed when the message is transmitted asynchronously based on the CoAP protocol in the related technology is solved, and the availability of the message transmission asynchronously based on the CoAP protocol is improved.
In some of these embodiments, the message ID of the target response in response sending module 60 is the same as the message ID of the acknowledgement response.
In some of these embodiments, the response sending module 60 is further configured to retransmit the acknowledgement response when the client session of the client has been destroyed; and destroying the server session when the retransmission times reach a preset retransmission threshold.
In some of these embodiments, the message blocking options in response to the sending module 60 include a message length option and a transmission process control option.
The above-described respective modules may be functional modules or program modules, and may be implemented by software or hardware. For modules implemented in hardware, the various modules described above may be located in the same processor; or the above modules may be located in different processors in any combination.
There is also provided in this embodiment a computer device comprising a memory in which a computer program is stored and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Optionally, the computer device may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps on the client side by a computer program:
s1, generating a client request; a client session is created based on the client request.
S2, sending a client request to a server, wherein the client request carries a unique identifier; wherein, the client request transmissions with the same unique identification are all carried out in the same client session.
S3, receiving the confirmation response and the target response of the server.
And S4, releasing the client session when the message transmission is completed.
Or the server side comprises the following steps:
s11, when a client request is acquired, a server session is created.
S12, generating a confirmation response according to the client request, wherein the confirmation response carries a unique identifier; the method comprises the steps of receiving a plurality of acknowledgement response transmissions with the same unique identification, wherein the acknowledgement response transmissions with the same unique identification are all carried out in the same server session; setting a temporary option in the acknowledgement response based on the CoAP extension protocol; and sending the confirmation response to the client.
S13, generating a target response when the server resource is ready; setting a message blocking option in a target response based on a CoAP extension protocol; and sending the target response to the client.
S14, when the message transmission is completed, releasing the server session.
It should be noted that, specific examples in this embodiment may refer to examples described in the foregoing embodiments and alternative implementations, and are not described in detail in this embodiment.
It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to be limiting. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure in accordance with the embodiments provided herein.
It is to be understood that the drawings are merely illustrative of some embodiments of the present application and that it is possible for those skilled in the art to adapt the present application to other similar situations without the need for inventive work. In addition, it should be appreciated that while the development effort might be complex and lengthy, it will nevertheless be a routine undertaking of design, fabrication, or manufacture for those of ordinary skill having the benefit of this disclosure, and further having the benefit of this disclosure.
The term "embodiment" in this disclosure means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive. It will be clear or implicitly understood by those of ordinary skill in the art that the embodiments described in the present application can be combined with other embodiments without conflict.
The foregoing examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the claims. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. The message transmission method based on the CoAP extension protocol is characterized by being applied to a message transmission system based on the CoAP extension protocol, wherein the message transmission system comprises a client side and a server side, the message transmission method is suitable for the client side, and the message transmission method comprises the following steps:
generating a client request; creating a client session according to the client request;
sending the client request to a server, wherein the client request carries a unique identifier; the unique identification is transmitted by the client request for a plurality of times, and the unique identification is transmitted in the same client session;
receiving the confirmation response and the target response of the server;
and releasing the client session when the message transmission is completed.
2. The CoAP extension protocol based message transmission method of claim 1, further comprising, after receiving the acknowledgement response from the server:
according to the confirmation response, canceling a message retransmission mechanism;
setting a waiting timeout time for receiving the target response.
3. The CoAP extension protocol based message transmission method as claimed in claim 2, wherein after setting a waiting timeout period according to the acknowledgement response, further comprising:
and destroying the client session when the target response is not received within the waiting timeout time, and notifying a user that the client request fails.
4. The message transmission method based on the CoAP extension protocol is characterized by being applied to a message transmission system based on the CoAP extension protocol, wherein the message transmission system comprises a client and a server, the message transmission method is suitable for the server, and the message transmission method comprises the following steps:
when a client request is acquired, a server session is created;
generating a confirmation response according to the client request, wherein the confirmation response carries a unique identifier; the multiple acknowledgement response transmissions with the same unique identification are all performed in the same server session; setting a temporary option in the acknowledgement response based on the CoAP extension protocol; sending the confirmation response to the client;
generating a target response when the server resource is ready; setting a message blocking option in the target response based on the CoAP extension protocol; sending the target response to the client;
and releasing the server session when the message transmission is completed.
5. The CoAP extension protocol based message transmission method in claim 4, wherein generating the target response when the server resource is ready comprises:
the message ID of the target response is the same as the message ID of the acknowledge response.
6. The CoAP extension protocol based message transmission method of claim 4, further comprising, after the sending the acknowledgement response to the client:
retransmitting the confirmation response when the client session of the client has been destroyed;
and destroying the server session when the retransmission times reach a preset retransmission threshold.
7. The CoAP extension protocol based message transmission method of claim 4, wherein the message blocking options include a message length option and a transmission process control option.
8. A CoAP extension protocol-based message transmission device, which is applied to a CoAP extension protocol-based message transmission system, wherein the message transmission system comprises a client and a server, the message transmission device is suitable for the client, and the message transmission device comprises:
the request generation module is used for generating a client request; creating a client session according to the client request;
the request sending module is used for sending the client request to the server, wherein the client request carries a unique identifier; the unique identification is transmitted by the client request for a plurality of times, and the unique identification is transmitted in the same client session;
the response receiving module is used for receiving the confirmation response of the server; receiving a target response of the server;
and the first session releasing module is used for releasing the client session when the message transmission is completed.
9. A CoAP extension protocol-based message transmission device, which is applied to a CoAP extension protocol-based message transmission system, wherein the message transmission system comprises a client and a server, the message transmission device is suitable for the server, and the message transmission device comprises:
the response generation module is used for creating a server session when the client request is acquired; generating a confirmation response according to the client request, wherein the confirmation response carries a unique identifier; the multiple acknowledgement response transmissions with the same unique identification are all performed in the same server session; setting a temporary option in the acknowledgement response based on the CoAP extension protocol; generating a target response when the server resource is ready; setting a message blocking option in the target response based on the CoAP extension protocol;
the response sending module is used for sending the confirmation response to the client; sending the target response to the client;
and the second session releasing module is used for releasing the server session when the message transmission is completed.
10. A computer device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the steps of the CoAP extension protocol based message transmission method of any one of claims 1 to 3 or the steps of the CoAP extension protocol based message transmission method of any one of claims 4 to 7.
CN202310889271.6A 2023-07-19 2023-07-19 Message transmission method, system and device based on CoAP extension protocol Pending CN117155986A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310889271.6A CN117155986A (en) 2023-07-19 2023-07-19 Message transmission method, system and device based on CoAP extension protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310889271.6A CN117155986A (en) 2023-07-19 2023-07-19 Message transmission method, system and device based on CoAP extension protocol

Publications (1)

Publication Number Publication Date
CN117155986A true CN117155986A (en) 2023-12-01

Family

ID=88883176

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310889271.6A Pending CN117155986A (en) 2023-07-19 2023-07-19 Message transmission method, system and device based on CoAP extension protocol

Country Status (1)

Country Link
CN (1) CN117155986A (en)

Similar Documents

Publication Publication Date Title
US10498831B2 (en) Communication sessions at a CoAP protocol layer
CN107104936B (en) Establish the method and system of full-duplex bi-directional communication
US7502860B1 (en) Method and apparatus for client-side flow control in a transport protocol
KR100733196B1 (en) Between-load-and-vehicle communication system
CN108494782B (en) Data transmission method based on UDP (user Datagram protocol), terminal equipment and storage medium
EP3338396B1 (en) Device and method for establishing connection in load-balancing system
CN107071826A (en) The method and apparatus of transmitting data resources
JP2014524092A (en) System and method for reliable virtual bidirectional data stream communication with single socket point-to-multipoint performance
CN102648612B (en) Method and system for managing a connection in a connection oriented in-order delivery environment
US7747694B2 (en) Low latency and assured delivery using HTTP
JP5185955B2 (en) Method for improving TCP data transmission process when physical transmission medium is interrupted
CN103957169A (en) Reliable UDP achievement method based on reserve request
CN109922144B (en) Method and apparatus for processing data
CN113765976A (en) Communication method and system
WO2018112327A1 (en) Methods of concurrency control for block transfer in coap publish-subscribe architecture
JP2012186839A (en) Communication method based on udp
WO2017061916A1 (en) Network node, wireless device and methods performed thereby for the network node to provide information to the wireless device
US7349384B2 (en) Reliable one-way messaging over request-response transport protocols
CN111385068A (en) Data transmission method and device, electronic equipment and communication system
CN117155986A (en) Message transmission method, system and device based on CoAP extension protocol
EP3672189B1 (en) Data transmission method, device and system
EP2245537A1 (en) Network message management device and methods thereof
Bedon et al. A DTN system for nanosatellite-based sensor networks using a new ALOHA multiple access with gateway priority
CN105897601A (en) Business request processing method and device
JP4882856B2 (en) COMMUNICATION SYSTEM, COMMUNICATION DEVICE, COMMUNICATION METHOD, AND COMMUNICATION PROGRAM

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