mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/nanocoap_cli: add test for no-response
This commit is contained in:
parent
1cfcb307f2
commit
29cb2d05a3
@ -32,12 +32,14 @@ extern int nanotest_client_cmd(int argc, char **argv);
|
||||
extern int nanotest_client_url_cmd(int argc, char **argv);
|
||||
extern int nanotest_server_cmd(int argc, char **argv);
|
||||
extern int nanotest_client_put_cmd(int argc, char **argv);
|
||||
extern int nanotest_client_put_non_cmd(int argc, char **argv);
|
||||
static int _list_all_inet6(int argc, char **argv);
|
||||
|
||||
static const shell_command_t shell_commands[] = {
|
||||
{ "client", "CoAP client", nanotest_client_cmd },
|
||||
{ "url", "CoAP client URL request", nanotest_client_url_cmd },
|
||||
{ "put", "experimental put", nanotest_client_put_cmd },
|
||||
{ "put_non", "non-confirmable put", nanotest_client_put_non_cmd },
|
||||
{ "server", "CoAP server", nanotest_server_cmd },
|
||||
{ "inet6", "IPv6 addresses", _list_all_inet6 },
|
||||
{ NULL, NULL, NULL }
|
||||
|
@ -298,3 +298,22 @@ int nanotest_client_put_cmd(int argc, char **argv)
|
||||
nanocoap_block_request_done(&ctx);
|
||||
return res;
|
||||
}
|
||||
|
||||
int nanotest_client_put_non_cmd(int argc, char **argv)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (argc < 3) {
|
||||
printf("usage: %s <url> <data>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
nanocoap_sock_t sock;
|
||||
nanocoap_sock_url_connect(argv[1], &sock);
|
||||
|
||||
res = nanocoap_sock_put_non(&sock, sock_urlpath(argv[1]), argv[2], strlen(argv[2]),
|
||||
NULL, 0);
|
||||
nanocoap_sock_close(&sock);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user