Hello
I have an Arduino Mega connected to a WiFly shield with RN 131C.
My Arduino have also some sensors and is collecting information.
I want to receive the information on a webserver that is running outside (I have one written on an Android)…
if(client.connected() || client.connect())
{
String data = "this is my data to send to server";
client.println("POST /arduino?" + data + " HTTP/1.0");
client.println("Host: 192.168.1.3:2345");
client.println("Content-Type: application/x-www-form-urlencoded" );
client.println("User-Agent: Arduino");
client.println("Connection: close");
client.println();
// client.stop();
}
The code is running in the loop and I try any delay between the loops from 500 ms to 5000 ms.
The first call is arriving into the server. The next I can see that is sent ( It’s getting inside the “if”) but no data is received on the server side.
I tested the server from outside with different testing scripts and the server is working properly.
If I uncomment the “stop” line and the “connection” is reopened every time everything is working fine. The problem is that the “stop” is taking about 8 seconds and the first time connection also is taking a lot of time so is not an option for me.
Thanks
Daniel