* ping buffer zeroed now

* ping string change
* client name changed on init
This commit is contained in:
Dávid Danyi 2018-03-01 17:00:50 +01:00
parent e77d494e4d
commit 8755bad974

View File

@ -22,10 +22,11 @@ char * buffer;
* 40.115.26.19 - ethinnoday-lwm2m-server.westeurope.cloudapp.azure.com * 40.115.26.19 - ethinnoday-lwm2m-server.westeurope.cloudapp.azure.com
* 5.39.83.206 - leshan.eclipse.org * 5.39.83.206 - leshan.eclipse.org
*/ */
ArduinoClient wakaamaClient("coap://5.39.83.206:5683"); ArduinoClient wakaamaClient("yvan_arduino_client", "coap://5.39.83.206:5683");
void setup() { void setup() {
buffer = static_cast<char*>(malloc(250)); buffer = static_cast<char*>(malloc(5));
memset(buffer, 0, 5);
DEBUG_STREAM.begin(DEBUG_STREAM_BAUD); DEBUG_STREAM.begin(DEBUG_STREAM_BAUD);
while(!DEBUG_STREAM) { while(!DEBUG_STREAM) {
; ;
@ -61,7 +62,7 @@ void loop() {
} }
} }
nbIOT.sendSocket(pingSocket, "87.229.111.223", 1111, (uint8_t*)"asdf", 4); nbIOT.sendSocket(pingSocket, "87.229.111.223", 1111, (uint8_t*)"pong", 4);
pending = nbIOT.socketBytesPending(pingSocket); pending = nbIOT.socketBytesPending(pingSocket);
if(pending > 0) { if(pending > 0) {
nbIOT.socketReceive(pingSocket, buffer, pending); nbIOT.socketReceive(pingSocket, buffer, pending);