From ab58b96f088e26a3936ce55398bab9fc1a9b044e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Danyi?= Date: Thu, 1 Mar 2018 16:59:26 +0100 Subject: [PATCH] * new constructor added to change the client name * read bytes should be pending bytes, not buffer size --- src/wakaama-client.cpp | 2 +- src/wakaama-client.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wakaama-client.cpp b/src/wakaama-client.cpp index d6e66de..29c663c 100644 --- a/src/wakaama-client.cpp +++ b/src/wakaama-client.cpp @@ -107,7 +107,7 @@ void ArduinoClient::doWorkStep() { SerialUSB.println(F("parsePacket()")); size_t pending = data.nbIOT->socketBytesPending(data.sock); if (pending > 0) { - size_t numBytes = data.nbIOT->socketReceive(data.sock, packetBuffer, 512); + size_t numBytes = data.nbIOT->socketReceive(data.sock, packetBuffer, pending); connection_t * connP; connP = connection_find(data.connList, data.sock); diff --git a/src/wakaama-client.h b/src/wakaama-client.h index cd50e8c..f35224f 100644 --- a/src/wakaama-client.h +++ b/src/wakaama-client.h @@ -33,6 +33,7 @@ class ArduinoClient { public: ArduinoClient(const char *uri) : uri(uri) {}; + ArduinoClient(const char *name, const char *uri) : name(name),uri(uri) {}; void init(Sodaq_nbIOT *nbiot); ~ArduinoClient(); void doWorkStep();