table of contents
COAP-CLIENT(5) | coap-client Manual | COAP-CLIENT(5) |
NAME¶
coap-client - CoAP Client based on libcoap
SYNOPSIS¶
coap-client [-a addr] [-b [num,]size] [-e text] [-f file] [-l loss] [-m method] [-o file] [-p port] [-r] [-s duration] [-t type] [-v num] [-A type] [-B seconds] [-K interval] [-N] [-O num,text] [-P addr[:port]] [-T token] [-U] [[-k key] [-u user]] [[-c certfile] [-C cafile] [-R root_cafile]] 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, coap+tcp, coaps or coaps+tcp. coaps and coaps+tcp are only supported when coap-client is built with support for secure (D)TLS communication.
If coaps or coap+tcp is being used, provided the CoAP server supports PKI and is configured with a Certificate and Private Key, the coap-client does not need to have a Pre-Shared Key (-k) or Certificate (-c) configured.
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 - GENERAL¶
-a addr
-b [num,]size
-e text
-f file
-l list
-l loss%
-m method
-o file
-p port
-r
-s duration
-t type
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
-A type
-B seconds
-K interval
-N
-O num,text
-P addr[:port]
-T token
-U
OPTIONS - PSK¶
(If supported by underlying (D)TLS library)
-k key
-u user
OPTIONS - PKI¶
(If supported by underlying (D)TLS library)
-c certfile
-C cafile
-R root_cafile
EXAMPLES¶
coap-client coap://coap.me
Query the resource / from server coap.me (using the GET method).
coap-client -m get coap://[::1]/
Query the resource / on localhost using the GET method to get back the summary defined attributes.
coap-client -m get coap://[::1]/.well-known/core
Query on the resource .well-known/core on localhost to get back a list of the known resources along with their attribute definitions.
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 actually required in this instance.
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 using a token of 3a via the PUT method.
FILES¶
There are no configuration files.
EXIT STATUS¶
0
1
BUGS¶
Please report bugs on the mailing list for libcoap: libcoap-developers@lists.sourceforge.net
AUTHORS¶
The libcoap project <libcoap-developers@lists.sourceforge.net>
11/09/2019 | coap-client 4.2.1 |