Wifly: client.print not working without Serial monitor

Hi guys,

Currently I am working on a prototype that basically waits for a ping on A0 and sends a POST request to the client. Surprisingly we got stuff working with the Wifly (sparkfun shield) on the uno. But a rather peculiar thing is happening: - When the arduino is connected to the computer, the requests are made, no prob! - Detached from the computer, the request are not made anymore (you can see that the only the green led on the wifly is flickering meaning that it is connected) --> We've managed to boil the problem down to this: When we remove the Serial.begin and serial.print's, the prototype stops doing out requests (which are made as client.println()) even when connected to the computer.

So the problem is that as soon as the serial monitor is not connected or serial library is not begun, the client.print does not work.... Does anyone has any idea?

-code:

We use the alpha 2 version of the WiFly library (http://forum.sparkfun.com/viewtopic.php?p=115626)

#include "WiFly.h"

Client client("foo.com", 80);

String postData = "var=foo";
boolean calling = false;

void setup() {
  
  Serial.begin(9600);
    
  WiFly.begin();
  
  Serial.println("connecting...");
  
}

void loop() {
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
  
  int call = analogRead(A0);
  if(call > 100 && calling == false){
     calling == true;
     doRequest(); 
  }
    
  if (!client.connected()) {
    Serial.println();
    if(calling == true){
        Serial.println("disconnecting.");
        client.stop();
    } else {
         Serial.println("no connection");
    }
    calling == false;
  }
}

void doRequest(){
    if (client.connect()) {
      
      Serial.println("connected");
      client.println("POST http://foo.com/now.php HTTP/1.1");
      client.println("Host: foo.com");
      client.println("Content-Type: application/x-www-form-urlencoded");
      client.println("Connection: close");
      client.print("Content-Length: ");
      client.println(postData.length());
      client.println();
      client.print(postData);
      client.println();
    } else {
      Serial.println("connection failed");
      calling = false;
    }
}