Sorry Terence,
we are using Existing code from mbed ARM, and expanding it.
Anyhow, could you please explain me about following questions:
-
How IOT device is communicating to cloud, is it with Socket or as a HTTP client ???
-
Is it required to really close Cloud Connection before connecting to Web server ??
as you said earlier , i can use 2 different Socket for this purpose, can u plz explain with any sample example, how i can do it. ??
FYI:
As soon as I get trigger from cloud, i am closing my cloud connection with API:
//Close Existing CLOUD Connection
client->close();
free(client);
My Working Enviornment:
Wi-Fi Dev Board: follow link : Mbed Connect Cloud | Mbed
Mbed Cloud Connect starter KIT Board (Ublox EVK ODIN W262 MCU ) and Windows mbed_installer_v041
Code: Existing mbed-connect-cloud-application code from ARM mbed.
Do you have this code with you ??
any how i am attaching my main.cpp file.
As you know in my main (),
-
Connecting to wife network
-
Then i am connecting to my Web-server with Http POST: open TCP socket getting new data, Closing socket.
Note: if i kept same code in while(1), to get data from Web-server, without connection to cloud. working properly.
-
Connecting to cloud with
client = new SimpleM2MClient(network, &sd, &fs);
client->on_registered(®istered_cb);
int init_rt = client->init();
-
Connected to cloud, and Updating new data from step-2, to cloud page.
-
All is done well.
Issue Start Here: Reconnecting back to Web server.
-
after some time again, let say after 10 min, if i want to get new data from Webserver and update it to cloud, I am Not able to connect back to My Webserver.
Please find the google drive link for main.cpp file:
can not attach a C / txt file, only allowed format is JPEG/JPG/PNG
if possible, please modify my code.