Subject: [core] Ticket #390 - CoAP over TCP: Connection close reason

From: Hannes Tschofenig <[email-masked]>
Date: Sat, 26 Mar 2016 16:33:48 +0100

In https://trac.tools.ietf.org/wg/core/trac/ticket/390 Klaus provided
feedback for the CoAP over TCP draft and wrote:

"
When a client or a server has to close a connection (for example, due to
an unrecoverable error), there should be a message with the reason.

Reasons might include:

A client or server sends a bad message.
 - The Length is less than 2.
 - TKL is greater than 8.
 - The message is shorter than TKL.
 - The message is Empty.
The connection timed out.
The server lacks the system resources to service a new connection.
The server does not service the connection itself but redirects traffic
to another host.
The server is being shut down and all connections are closed.
The client or server sends a message in an unsupported version.
"

Currently, the CoAP over TCP draft only adds a shim header to convey
length information. As Klaus pointed out it is possible that errors may
occur during processing of that shim header. The failure to process the
shim header will prevent any CoAP message header parsing but the plain
TCP handling will be fine.

It may be reasonable to define an error response message in case
something is wrong with the shim header processing. However, I don't
think anything else (such as TCP-related errors, such as timeouts or
lack of resources) should be conveyed.

The challenge is, however, that we would have to define an additional
field -- a command type -- to distinguish a regular message from an
error response.

If we do that we could (referring to ticket #394) also define a
keep-alive message at that layer as well or even a version negotiation
(referring to ticket #389).

I think you raised an interesting point and I wonder what others in the
group think about it.

Ciao
Hannes