diff --git a/examples/gcoap/client.c b/examples/gcoap/client.c index f4dc8aaa9be6..b58c48f178cb 100644 --- a/examples/gcoap/client.c +++ b/examples/gcoap/client.c @@ -66,8 +66,8 @@ static size_t obs_req_tkl = 0; uint16_t req_count = 0; static gcoap_socket_type_t _get_tl(const char *uri); -static size_t _send(uint8_t *buf, size_t len, const sock_udp_ep_t *remote, - void *ctx, gcoap_socket_type_t tl); +static ssize_t _send(uint8_t *buf, size_t len, const sock_udp_ep_t *remote, + void *ctx, gcoap_socket_type_t tl); /* * Response callback. @@ -172,10 +172,10 @@ static gcoap_socket_type_t _get_tl(const char *uri) return GCOAP_SOCKET_TYPE_UNDEF; } -static size_t _send(uint8_t *buf, size_t len, const sock_udp_ep_t *remote, - void *ctx, gcoap_socket_type_t tl) +static ssize_t _send(uint8_t *buf, size_t len, const sock_udp_ep_t *remote, + void *ctx, gcoap_socket_type_t tl) { - size_t bytes_sent = gcoap_req_send(buf, len, remote, _resp_handler, ctx, tl); + ssize_t bytes_sent = gcoap_req_send(buf, len, remote, _resp_handler, ctx, tl); if (bytes_sent > 0) { req_count++; } @@ -389,8 +389,8 @@ int gcoap_cli_cmd(int argc, char **argv) printf("gcoap_cli: sending msg ID %u, %" PRIuSIZE " bytes\n", coap_get_id(&pdu), len); - if (!_send(&buf[0], len, *_proxy_uri ? &_proxy_remote : &remote, NULL, - *_proxy_uri ? _get_tl(_proxy_uri) : _get_tl(_last_req_uri))) { + if (_send(&buf[0], len, *_proxy_uri ? &_proxy_remote : &remote, NULL, + *_proxy_uri ? _get_tl(_proxy_uri) : _get_tl(_last_req_uri)) <= 0) { puts("gcoap_cli: msg send failed"); } else {