1.7.4. DLN_DISCONNECT

DLN_DISCONNECT Command

Go to response

The DLN_DISCONNECT command closes the connection to the specified DLN server.

  typedef struct
   {
      DLN_MSG_HEADER header;
      char host[DLN_MAX_HOST_LENGTH+1];
      uint16_t port;
   } __PACKED_ATTR DLN_DISCONNECT_CMD;

Parameters:

header
Defines the DLN message header DLN_MSG_HEADER. The header contains several predefined fields and is used to identify and route messages. When sending the command, a user must fill the following fields:
  • size - The size of the message. Must be equal to the size of the DLN_DISCONNECT_CMD structure.
  • msgId - Defines the message. For the DLN_DISCONNECT command it must be set to 0x0011. You can use the DLN_MSG_ID_DISCONNECT constant.
  • echoCounter - Can be used to link a command to a response. The response will have the same echoCounter value. This field can be any numerical value from 0 to 0xFFFF (65536).
  • handle - A handle to the DLN-series adapter. For the DLN_DISCONNECT command the HDLN_ALL_DEVICES value must be used.
host
A server to close the connection to. This value can be a URL (e.g. www.diolan.com), or an IP address (e.g. 127.0.0.1). In order to close the connection to a server, launched on the same computer, you can use the predefined "localhost" value as a host name.
port
A port number of the DLN server.

DLN_DISCONNECT Response

Go to command

The adapter sends the DLN_DISCONNECT response after the command execution. The result field informs a user if the connection has been successfully closed.

  typedef struct
  {
     DLN_MSG_HEADER header;
     DLN_RESULT result;
  } __PACKED_ATTR DLN_DISCONNECT_RSP;

Parameters:

header
Defines the DLN message header DLN_MSG_HEADER. The response header contains the following fields:
  • size - The size of the message. It is equal to the size of the DLN_DISCONNECT_RSP structure.
  • msgId - Defines the message. For the DLN_DISCONNECT response it is set to 0x0011. The DLN_MSG_ID_DISCONNECT constant can be used.
  • echoCounter - Links a command to a response. The echoCounter value is copied from the respective command header.
  • handle - A handle to theDLN-series adapter. For the DLN_DISCONNECT response the HDLN_ALL_DEVICES value is used.
result
Contains the result of the command execution. The following values are available: