My twitter test code couldn't allow me tweet more than once.

Hi all, as title suggested, I have no issue to send out single tweet in the program. I already updated Twitter.h and Twitter.cpp to compatible with wifi shield. The issue is occurs when I have multiple tweet’s need to post. I’ve put some delay around 2 minute in between each tweets to avoid over load the server. The result only first tweet posted up and the second one is connection failed. Please refer to my code below. Thanks in advance… $) $) $)

#include <SPI.h> 
#include <Twitter.h>
#include <WiFi.h>


char ssid[] = "Farizal_Mi3";//  your network SSID (name) 
char pass[] = "abcdefgh";   // your network password
int keyIndex = 0;           // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;
WiFiServer server(80);

String readString;

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("MY TOKEN");

void setup()
{
  delay(1000);
  Serial.begin(9600);
  
  // start the WiFi connection and the server:  

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present"); 
    while(true);        // don't continue
  } 

  String fv = WiFi.firmwareVersion();
  if( fv != "1.1.0" )
    Serial.println("Please upgrade the firmware");

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) { 
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(ssid);                   // print the network name (SSID);

    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:    
    status = WiFi.begin(ssid, pass);
    // wait 10 seconds for connection:
    delay(10000);
  } 
  server.begin();                           // start the web server on port 80
  printWifiStatus();                        // you're connected now, so print out the status
   
}//Setup END

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
  // print where to go in a browser:
  Serial.print("To see this page in action, open a browser to http://");
  Serial.println(ip);
}

void loop()
{
  delay(1000);
  Serial.println("First tweet is sending...");
  
  if (twitter.post("@mdfarizal8 Hi From Galileo : test tweet First"))
  {
    Serial.println ("First tweet : OK.");
  }
  else
  {
    Serial.println("First tweet connection failed.");
  } 
  
  Serial.println("Delay 2 min");
  delay(60000); //Msg interval delay
  Serial.println("Delay 1 min");
  delay(60000); //Msg interval delay
  Serial.println("End Delay");
  
  delay(1000);
  Serial.println("Second tweet is sending...");
  if (twitter.post("@mdfarizal8 Hi From Galileo : test tweet 2nd"))
  {
    Serial.println ("Second tweet :OK.");
  }
  else
  {
    Serial.println("Second tweet connection failed.");
  }   
  do{} while(1>0); // endless loop
}

Below is an output from serial monitor:

Attempting to connect to Network named: Farizal_Mi3
SSID: Farizal_Mi3
IP Address: 192.168. 43.128
signal strength (RSSI):-51 dBm
To see this page in action, open a browser to http://192.168. 43.128
First tweet is sending…
First tweet : OK.
Delay 2 min
Delay 1 min
End Delay
Second tweet is sending…
Second tweet connection failed.

According to: http://playground.arduino.cc/Code/TwitterLibrary

bool post(const char *message)

Begin posting the specified message to Twitter. If connection to twitter.com is established successfully, this function returns true.

If failed to connect Twitter, returns false. (Check Ethernet is correctly configured.)
Posting is not done yet even it returns true. You should call twitter.checkStatus() periodically or twitter.wait().

Perhaps check the status?

Checked already the second twitter connection is failed.

When you send something to a server, the server sends a reply. I can't see that the twit library is actually reading what the server responded with.

On a WiFi shield, only one connection at a time is supported. That connection may still be in use, because the server response has not yet been read.

So this mean the library only support for Ethernet shield server reply and not for wifi shield? any solution for wifi shield?

Checked already the second twitter connection is failed.

So, you modified your code, and it didn't do what you expected, but you didn't think that we'd want to see the changed code? Wrong.

So this mean the library only support for Ethernet shield server reply and not for wifi shield?

No, that's not what it means. What it meant was that you needed to look at the library to see that it is actually reading the server response and closing the connection correctly. Or post a link to the library, so we could look at it.

But, Nick already did that, and it does look like the library is reading the server response IF you call checkStatus() (with a non-NULL value) or wait() (with a non-NULL value).

We can't see that you properly do that.

mdfraizal:
Checked already the second twitter connection is failed.

As PaulS says, if you changed the code, and it still doesn't work, post the changed code.

Who knows what you actually did? (except you)

Twitter requires SSL now, and neither the ethernet library nor the WiFi library support SSL connections.

You are probably getting this response from the Twitter server.

HTTP/1.1 301 Moved Permanently
date: Fri, 30 May 2014 03:01:12 UTC
location: https://search.twitter.com
server: tfe
set-cookie: guest_id=v1%3A137783167277866638; Domain=.twitter.com; Path=/; Expires=Sun, 30-Aug-2015 03:01:12 UTC
Content-Length: 0
Connection: close

If you are trying to relay through another server, that could also be a problem. The relay server operator must have written permission from Twitter to do that.

I don't think this is an issue, since I still can send anytime one tweet with no issue. The problem is for consecutive tweet only.

The issue is that you haven't posted your current code.

mdfraizal:
I don't think this is an issue, since I still can send anytime one tweet with no issue. The problem is for consecutive tweet only.

How much time delay do you put between your tweets? The server may reject short interval tweets. I also remember something to the effect that what appear to be duplicate tweets will be rejected.

The server may reject short interval tweets. I also remember something to the effect that what appear to be duplicate tweets will be rejected.

Which is ANOTHER reason we need to see your code AND the server response.