Show Posts
Pages: [1]
1  Topics / Home Automation and Networked Objects / Re: HELP on pushingbox HTTP request on: November 30, 2012, 06:17:43 am
I have it working at the moment by replacing: void sendToPushingBox(String devid) with void sendToPushingBox(char devid[]) although I think both should work fine. It also worked before with String, and when I send exactly the same text to serial, I se it 100% correct as it should be. Anyway it seems to work now. Reply from the server is OK as well.
I don't need to put all Serial.prints on 1 line, it works as the api-example as well. I have the impression that somewhere in Ethernet.client something is a bit unstable.
The issue I have now is that mails arrive only after several hours. I asked people from Pushingbox how this is possible. Before it was instantanious.
2  Topics / Home Automation and Networked Objects / Re: HELP on pushingbox HTTP request on: November 25, 2012, 08:53:28 am
Hi
I'm having exactly the same issue. Sometimes it works for days. Then it stops working or only few mails go through.
Each time the Arduino reports a correct connection. When I try with cURL or with a browser, it works OK.
I tried a lot of different things:
- another Arduino and Ethernet card. Network is OK on both, I can brwse to them perfectly (they're server as well).
- putting \r\n as end of line instead of just \n
- change #define to const String..., but this is just cosmetics
- start the card with or witout mentionning dns, gateway. No difference.
Here the code:
void sendToPushingBox(String devid){
  #ifdef DEBUG_SERIAL
    Serial << F("Connecting to PushingBox") << newLineSerial;
  #endif
  if (client.connect(serverName, 80)) {
    #ifdef DEBUG_SERIAL
      if(client.connected())
        Serial << F("client connected to PushingBox") << newLineSerial;
      else
        Serial << F("client NOT connected to PushingBox") << newLineSerial;
      Serial << F("sending GET request") << newLineSerial;
    #endif
    Serial << F("GET /pushingbox?devid=") << devid << F(" HTTP/1.1\r\n");
    Serial << F("Host: ") << serverName << F("\r\n");
    Serial << F("User-Agent: Arduino\r\n");
    Serial << F("\r\n");
    client << F("GET /pushingbox?devid=") << devid << F(" HTTP/1.1\r\n");
    client << F("Host: ") << serverName << F("\r\n");
    client << F("User-Agent: Arduino\r\n");
    client << F("\r\n");
  }
  else {
    Serial << F("PushingBox connection failed") << newLineSerial;
  }
  // if there are incoming bytes available from the server, read and print them:
  #ifdef DEBUG_SERIAL
    delay(1000);
    if (client.available()) {
      char c = client.read();
      Serial << c;
    }
    Serial << F("disconnecting") << newLineSerial;
  #endif
  client.stop();
}


Here the debug-info:
Setting up Ethernet card
Ready, delay 5 sec to setup Ethernet card
Connecting to PushingBox
client connected to PushingBox
sending GET request
GET /pushingbox?devid=vDCC7D695F4F8672 HTTP/1.1
Host: api.pushingbox.com
User-Agent: Arduino

disconnecting


I guess it's more a network issue, but I can't put my hands on it. Does someone have an idea? If not I'll need to put a sniffer to see what exactly is going over the network.
Pages: [1]