File: coap-client.txt.in

package info (click to toggle)
libcoap 4.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 2,540 kB
  • ctags: 1,419
  • sloc: ansic: 10,982; sh: 4,486; makefile: 215
file content (169 lines) | stat: -rw-r--r-- 4,940 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// -*- mode:doc; -*-
// vim: set syntax=asciidoc,tw=0:

coap-client(5)
==============
:doctype: manpage
:revdate: @REVDATE@
:man source:   coap-client
:man version:  @PACKAGE_VERSION@
:man manual:   coap-client Manual

NAME
-----
coap-client - CoAP Client based on libcoap

SYNOPSIS
--------
*coap-client* [*-A* type1, _type2_ ,...] [*-t* type] [*-b* [num,]size]
              [*-B* seconds] [*-e* text] [*-f* file] [*-m* method] [*-N*]
              [*-o* file] [*-P* addr[:port]] [*-p* port] [*-s* duration]
              [*-O* num,text] [*-T* token] [*-v* num] [*-a* addr] [*-U*] URI

DESCRIPTION
-----------
*coap-client* is a CoAP client to communicate with 6LoWPAN devices via
the protocol CoAP (RFC 7252) using the URI given as argument on the
command line. The URI must have the scheme 'coap' (or 'coaps' when
coap-client was built with support for secure communication). The URI's
host part may be a DNS name or a literal IP address. Note that, for
IPv6 address references, angle brackets are required (c.f. EXAMPLES).


OPTIONS
-------
*-a* addr::
   The local address of the interface that has to be used.

*-b* [num,]size::
   The block size to be used in GET/PUT/POST requests (value must be a
   multiple of 16 not larger than 1024 as libcoap uses a fixed maximum
   PDU size of 1400 bytes). If 'num' is present, the request
   chain will start at block 'num'. When the server includes a Block2
   option in its response to a GET request, coap-client will automatically
   retrieve the subsequent block from the server until there are no more
   outstanding blocks for the requested content.

*-e* text::
   Include text as payload (use percent-encoding for non-ASCII characters).

*-f* file::
   File to send with PUT/POST (use '-' for STDIN).

*-m* method::
   The request method for action (get|put|post|delete), default is 'get'.
   (Note that the string passed to *-m* is compared case-insensitive.)

*-o* file::
   A filename to store data retrieved with GET.

*-p* port::
   The port to listen on.

*-s* duration::
   Subscribe to the resource specified by URI for the given 'duration' in
   seconds.

*-t* type::
   Content format for given resource for PUT/POST. 'type' must be either
   a numeric value reflecting a valid CoAP content format or a string
   describing a registered format. The following registered content format
   descriptors are supported, with alternative shortcuts given in
   parentheses:

     text/plain (plain)
     application/link-format (link, link-format)
     application/xml (xml)
     application/octet-stream (binary, octet-stream)
     application/exi (exi)
     application/json (json)
     application/cbor (cbor)

*-v* num::
   The verbosity level to use (default: 3, maximum is 9).

*-A* type::
   Accepted media types as comma-separated list of symbolic or numeric
   values, there are multiple arguments as comma separated list
   possible. 'type' must be either a numeric value reflecting a valid
   CoAP content format or a string that specifies a registered format as
   described for option *-t*.

*-B* seconds::
   Break operation after waiting given seconds (default is 90).

*-N* ::
   Send NON-confirmable message. If option *-N* is not specified, a
   confirmable message will be sent.

*-O* num,text::
   Add option 'num' with contents of 'text' to the request.

*-P* addr[:port]::
   Address (and port) for proxy to use (automatically adds Proxy-Uri option
   to request).

*-T* token::
   Include the 'token' to the request.

*-U* ::
   Never include Uri-Host or Uri-Port options.

EXAMPLES
--------
* Example
----
coap-client coap://coap.me
----
Query resource '/' from server 'coap.me' (via the GET method).

* Example
----
coap-client -m get coap://[::1]/
----
Query on localhost via the 'GET' method.

* Example
----
coap-client -m get coap://[::1]/.well-known/core
----
Quite the same, except on the resource '.well-known/core' on localhost.

* Example
----
echo -n "mode=on" | coap-client -m put \
coap://[2001:db8:c001:f00d:221:2eff:ff00:2704]:5683/actuators/leds?color=r -f-
----
Send text 'mode=on' to resource 'actuators/leds?color=r' on the endpoint with
address '2001:db8:c001:f00d:221:2eff:ff00:2704' and port '5683'. Note that the
port '5683' is the default port and isn't really needed to append.

* Example
----
coap-client -m put coap://[fec0::3]/ck -T 3a -t binary -f to_upload
----
Put the contents of file 'to_upload' with content type 'binary' (i.e.
application/octet-stream) into resource 'ck' on 'fec0::3' by usage of a token
'3a' via the 'PUT' method.

FILES
------
There are no configuration files.

EXIT STATUS
-----------
*0*::
   Success

*1*::
   Failure (syntax or usage error; configuration error; document
   processing failure; unexpected error)

BUGS
-----
Please report bugs on the mailing list for libcoap:
libcoap-developers@lists.sourceforge.net

AUTHORS
-------
The libcoap project <libcoap-developers@lists.sourceforge.net>