1COAP-SERVER(5) coap-server Manual COAP-SERVER(5)
2
3
4
6 coap-server - CoAP Server based on libcoap
7
9 coap-server [-d max] [-g group] [-l loss] [-p port] [-v num] [-A
10 address] [-N] [[-k key] [-h hint]] [[-c certfile] [-n] [-C cafile] [-R
11 root_cafile]]
12
14 coap-server is an example server for the 'Constrained Application
15 Protocol` (RFC 7252).
16
18 -d max
19 Enable support for creation of dynamic resources when doing a PUT
20 up to a limit of max. If max is reached, a 4.06 code is returned
21 until one of the dynamic resources has been deleted.
22
23 -g group
24 Join specified multicast group on startup.
25
26 -p port
27 The port on the given address will be listening for incoming
28 connections. If (D)TLS is supported, then port + 1 will also be
29 listened on for (D)TLS connections. The default port is 5683 if not
30 given any other value.
31
32 -l list
33 Fail to send some datagrams specified by a comma separated list of
34 numbers or number ranges (debugging only).
35
36 -l loss%
37 Randomly failed to send datagams with the specified probability -
38 100% all datagrams, 0% no datagrams (debugging only).
39
40 -v num
41 The verbosity level to use (default 3, maximum is 9). Above 7,
42 there is increased verbosity in GnuTLS and OpenSSL logging.
43
44 -A addr
45 The local address of the interface which the server has to listen.
46
47 -N
48 Send NON-confirmable message for \"observe\" responses. If option
49 -N is not specified, a confirmable response will be sent. Even if
50 set, every fifth response will still be sent as a confirmable
51 response (RFC 7641 requirement).
52
54 (If supported by underlying (D)TLS library)
55
56 -h hint
57 Pre-shared key hint to use for inbound connections. The default is
58 CoAP. This cannot be empty if defined.
59
60 -k key
61 Pre-shared key to use for inbound connections. This cannot be empty
62 if defined. Note: if -c cafile is defined, you need to define -k
63 key as well to have the server support both PSK and PKI.
64
66 (If supported by underlying (D)TLS library)
67
68 -c certfile
69 Use the specified PEM file which contains the CERTIFICATE and
70 PRIVATE KEY information. Note: if -k key is defined, you need to
71 define -c cafile as well to have the server support both PSK and
72 PKI.
73
74 -n
75 Disable the requirement for clients to have defined client
76 certificates
77
78 -C cafile
79 PEM file containing the CA Certificate that was used to sign the
80 certfile defined using -c certfile. If defined, then the client
81 will be given this CA Certificate during the TLS set up.
82 Furthermore, this will trigger the validation of the client
83 certificate. If certfile is self-signed (as defined by -c
84 certfile), then you need to have on the command line the same
85 filename for both the certfile and cafile (as in -c certfile -C
86 certfile) to trigger validation.
87
88 -R root_cafile
89 PEM file containing the set of trusted root CAs that are to be used
90 to validate the server certificate. The -C cafile does not have to
91 be in this list and is "trusted" for the verification.
92 Alternatively, this can point to a directory containing a set of CA
93 PEM files.
94
96 • Example
97
98 coap-server -A ::1
99
100 Let the server listen on localhost (port 5683).
101
102 • Example
103
104 coap-server -A ::1 -k mysecretKey -h myhint
105
106 Let the server listen on localhost (port 5683 and 5684) with the server
107 set up for PSK authentication.
108
109 • Example
110
111 coap-server -A ::1 -p 13011
112
113 The same, except the listening port is 13011 (and not the default port
114 5683).
115
116 • Example
117
118 coap-server -A 2001:db8:81a8:0:6ef0:dead:feed:beef -v 5
119
120 The listening address is set to 2001:db8:81a8:0:6ef0:dead:feed:beef and
121 the verbosity level is set to 5.
122
123 • Example
124
125 coap-server -A 2001:db8:81a8:0:6ef0:dead:feed:beef -g FF02::FD
126
127 Set listening address to 2001:db8:81a8:0:6ef0:dead:feed:beef and join
128 the All CoAP Nodes multicast group FF02::FD.
129
131 There are no configuration files.
132
134 0
135 Success
136
137 1
138 Failure (syntax or usage error; configuration error; document
139 processing failure; unexpected error)
140
142 Please report bugs on the mailing list for libcoap:
143 libcoap-developers@lists.sourceforge.net
144
146 The libcoap project <libcoap-developers@lists.sourceforge.net>
147
148
149
150coap-server 4.2.1 01/26/2021 COAP-SERVER(5)