Connecting to 2 different servers

Hi, I am using the Ethernet shield to connect to Yahoo server followed by Twitter server.

However after connected to Yahoo, it could not connect to the Twitter server.
And vice versa I connect to Twitter, I could not connect to Yahoo.

My sketch is shown below, please help.

#include <SPI.h> // for communicating with devices using the Serial Peripheral Interface (SPI) Bus
#include <Ethernet.h> // for connecting to the internet using the Arduino Ethernet
#include <TextFinder.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x4F, 0x8A };

IPAddress Twitterserver(199,59,148,10);
IPAddress Yahooserver(87,248,122,181);

EthernetClient client;
TextFinder finder( client );

char tweet[50];
int y = 0;
int Condition;
int Temp;
int check = 0;
int c;
char stat[5] = {'s','t','a','t',':'};

void setup()
{
Serial.begin(38400);
Ethernet.begin(mac);
}

void loop()
{
while (y < 1)
{
connectToYahooServer();
retrieveWeather();
connectToServer();
retrieveTweet();

y++;
}
}

void connectToServer()
{
Serial.println("Connecting to Twitter server...");
if (client.connect(Twitterserver, 80))
{
Serial.println("making HTTP request...");
client.println("GET /1/statuses/user_timeline.xml?id=lawrence_tay HTTP/1.1");
client.println("HOST: api.twitter.com");
client.println();
client.println("Connected...");
}
else
{
Serial.println("connection failed");
}
}

void connectToYahooServer()
{
if (client.connect(Yahooserver, 80))
{
Serial.println("Connecting to Yahoo Weather...");
client.println("GET /forecastrss?w=23424948&u=c HTTP/1.0"); // w: ID for Singapore 23424948 and u: unit in degress celcius
client.println("HOST:weather.yahooapis.com\n\n"); // http://weather.yahooapis.com/forecastrss?w=23424948&u=c
client.println(); //
client.println("Connected...");
}
else
{
Serial.println("connection failed");
}
}

void retrieveWeather()
{
if (client.connected()) // Whether or not the client is connected.
{
if(finder.find("code=") ) // Finds text "temp=" in weather Yahoo XML page source
{
Condition = finder.getValue(); // Gets the value following temp=
Serial.print("Condition: ");
Serial.println(Condition);
//Serial.print("Condition: ");

if((Condition >= 26) && (Condition <=30)){
Serial.println("Cloudy");
//GLCD.DrawBitmap(cloud, 82,32);
}
else if(Condition == 32){
Serial.println("Sunny");
// GLCD.DrawBitmap(sunny, 82,32);
}
else if((Condition >= 37) && (Condition <=40)){
Serial.println("Showers");
//GLCD.DrawBitmap(shower32, 82,32);
}
}
else
{
Serial.print("No weather Condition");
}
//if ( (finder.getString("Current Conditions:
",",",weather,20)!=0) )
if(finder.find("temp=") )
{
Temp = finder.getValue();
Serial.println(Temp);

Serial.print("Temp C: ");
Serial.println(Temp);
}
else
{
Serial.print("No temp data");
}
client.stop();
client.flush();
}
}

boolean retrieveTweet()
{
if (client.connected()) // Whether or not the client is connected.
{
if(finder.getString("","",tweet,50)!=0 ) // Finds text "temp=" in weather Yahoo XML page source
{
check = 0;
for(c = 0; c<5; c++)
{
if(tweet

 == stat[c])                        //check if the first 5 char = "stat:"
              {
                check += 1;
                Serial.print("check: ");
                Serial.println(check);
                Serial.println(tweet[c]);
                Serial.println(stat[c]);
              }
          }
      }
         if (check > 4)                        //it is a user status
           {
            if(finder.getString("<text>stat:","</text>",tweet,50)!=0 ) 
              {
              Serial.print("Message:  ");
              Serial.println(tweet);

              return true;
              }
            }
          else 
            {
              Serial.println("No message");
              Serial.println(tweet);

              return false;
            }
    client.stop();
    client.flush();
    }
}

You only have one 'client'. It can only be connected to one IP address and socket at a time.

Try using two clients:

EthernetClient twitterClient;
EthernetClient yahooClient;