trying to connect a server via ethernet shield

hello; i am trying to connect a server ; i am using the following code;in general it fails to connect , although it sometimes connects. can anyone show what the problem is.

#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x19, 0xC4 };
byte ip[] = { 192, 168, 2, 240 };
byte serverIp[] = { 192, 168, 2, 5 };

int backPortNo = 1292;

EthernetClient client;
EthernetServer backPortServer(backPortNo);

void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);

delay(1000);

backPortServer.begin();
Serial.print("Backport open:");
Serial.print(Ethernet.localIP());
Serial.print(":");
Serial.println(backPortNo);

// give the Ethernet shield a second to initialize:
delay(1000);
Serial.print("Server:");

// if you get a connection, report back via serial:
if (client.connect(serverIp, 10000)) {
Serial.println("connected");
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}

}

void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}

// as long as there are bytes in the serial queue,
// read them and send them out the socket if it's open:
while (Serial.available() > 0) {
char inChar = Serial.read();
if (client.connected()) {
client.print(inChar);
}
}

// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing:
while(true);
}
// }
}

Maybe it is the server? What server software do you have running on port 10000?

Why did you select that mac address ?
Could you try the default { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }

Which Arduino board are you using ?
Which Ethernet Shield (I guess the normal Arduino Ethernet shield with W5100).
Are you using the newest Arduino software vesion 1.0.5 ? (you should use the newest version)
How is it powered ? If you use USB to power it, and the cables are bad quality or powered by a laptop, it might not be enough.

P.S.: When posting a sketch, you can use the code tags (use the '#' button above the text input field for the code tags).

i am using mega adk; i wrote the mac address that is printed on the ethernet shield.

i was also driving a TFT screen ; i plugged it out and it connected to the server, hence it seems like the problem is about the power thank you so much