'\" t .\" Title: coap-client .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 2017-02-05 .\" Manual: coap-client Manual .\" Source: coap-client 4.1.2 .\" Language: English .\" .TH "COAP\-CLIENT" "5" "2017\-02\-05" "coap\-client 4\&.1\&.2" "coap\-client Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" coap-client \- CoAP Client based on libcoap .SH "SYNOPSIS" .sp \fBcoap\-client\fR [\fB\-A\fR type1, \fItype2\fR ,\&...] [\fB\-t\fR type] [\fB\-b\fR [num,]size] [\fB\-B\fR seconds] [\fB\-e\fR text] [\fB\-f\fR file] [\fB\-m\fR method] [\fB\-N\fR] [\fB\-o\fR file] [\fB\-P\fR addr[:port]] [\fB\-p\fR port] [\fB\-s\fR duration] [\fB\-O\fR num,text] [\fB\-T\fR token] [\fB\-v\fR num] [\fB\-a\fR addr] [\fB\-U\fR] URI .SH "DESCRIPTION" .sp \fBcoap\-client\fR 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 \fIcoap\fR (or \fIcoaps\fR when coap\-client was built with support for secure communication)\&. The URI\(cqs 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)\&. .SH "OPTIONS" .PP \fB\-a\fR addr .RS 4 The local address of the interface that has to be used\&. .RE .PP \fB\-b\fR [num,]size .RS 4 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 \fInum\fR is present, the request chain will start at block \fInum\fR\&. 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\&. .RE .PP \fB\-e\fR text .RS 4 Include text as payload (use percent\-encoding for non\-ASCII characters)\&. .RE .PP \fB\-f\fR file .RS 4 File to send with PUT/POST (use \fI\-\fR for STDIN)\&. .RE .PP \fB\-m\fR method .RS 4 The request method for action (get|put|post|delete), default is \fIget\fR\&. (Note that the string passed to \fB\-m\fR is compared case\-insensitive\&.) .RE .PP \fB\-o\fR file .RS 4 A filename to store data retrieved with GET\&. .RE .PP \fB\-p\fR port .RS 4 The port to listen on\&. .RE .PP \fB\-s\fR duration .RS 4 Subscribe to the resource specified by URI for the given \fIduration\fR in seconds\&. .RE .PP \fB\-t\fR type .RS 4 Content format for given resource for PUT/POST\&. \fItype\fR 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: .sp .if n \{\ .RS 4 .\} .nf 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) .fi .if n \{\ .RE .\} .RE .PP \fB\-v\fR num .RS 4 The verbosity level to use (default: 3, maximum is 9)\&. .RE .PP \fB\-A\fR type .RS 4 Accepted media types as comma\-separated list of symbolic or numeric values, there are multiple arguments as comma separated list possible\&. \fItype\fR must be either a numeric value reflecting a valid CoAP content format or a string that specifies a registered format as described for option \fB\-t\fR\&. .RE .PP \fB\-B\fR seconds .RS 4 Break operation after waiting given seconds (default is 90)\&. .RE .PP \fB\-N\fR .RS 4 Send NON\-confirmable message\&. If option \fB\-N\fR is not specified, a confirmable message will be sent\&. .RE .PP \fB\-O\fR num,text .RS 4 Add option \fInum\fR with contents of \fItext\fR to the request\&. .RE .PP \fB\-P\fR addr[:port] .RS 4 Address (and port) for proxy to use (automatically adds Proxy\-Uri option to request)\&. .RE .PP \fB\-T\fR token .RS 4 Include the \fItoken\fR to the request\&. .RE .PP \fB\-U\fR .RS 4 Never include Uri\-Host or Uri\-Port options\&. .RE .SH "EXAMPLES" .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Example .RE .sp .if n \{\ .RS 4 .\} .nf coap\-client coap://coap\&.me .fi .if n \{\ .RE .\} .sp Query resource \fI/\fR from server \fIcoap\&.me\fR (via the GET method)\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Example .RE .sp .if n \{\ .RS 4 .\} .nf coap\-client \-m get coap://[::1]/ .fi .if n \{\ .RE .\} .sp Query on localhost via the \fIGET\fR method\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Example .RE .sp .if n \{\ .RS 4 .\} .nf coap\-client \-m get coap://[::1]/\&.well\-known/core .fi .if n \{\ .RE .\} .sp Quite the same, except on the resource \fI\&.well\-known/core\fR on localhost\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Example .RE .sp .if n \{\ .RS 4 .\} .nf echo \-n "mode=on" | coap\-client \-m put \e coap://[2001:db8:c001:f00d:221:2eff:ff00:2704]:5683/actuators/leds?color=r \-f\- .fi .if n \{\ .RE .\} .sp Send text \fImode=on\fR to resource \fIactuators/leds?color=r\fR on the endpoint with address \fI2001:db8:c001:f00d:221:2eff:ff00:2704\fR and port \fI5683\fR\&. Note that the port \fI5683\fR is the default port and isn\(cqt really needed to append\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Example .RE .sp .if n \{\ .RS 4 .\} .nf coap\-client \-m put coap://[fec0::3]/ck \-T 3a \-t binary \-f to_upload .fi .if n \{\ .RE .\} .sp Put the contents of file \fIto_upload\fR with content type \fIbinary\fR (i\&.e\&. application/octet\-stream) into resource \fIck\fR on \fIfec0::3\fR by usage of a token \fI3a\fR via the \fIPUT\fR method\&. .SH "FILES" .sp There are no configuration files\&. .SH "EXIT STATUS" .PP \fB0\fR .RS 4 Success .RE .PP \fB1\fR .RS 4 Failure (syntax or usage error; configuration error; document processing failure; unexpected error) .RE .SH "BUGS" .sp Please report bugs on the mailing list for libcoap: libcoap\-developers@lists\&.sourceforge\&.net .SH "AUTHORS" .sp The libcoap project