Arduino WiFi programming issue

Hi,

I'm working on a project using Arduino Uno and Arduino WiFi shield. I used one of the examples on the web & it worked very well. The problem is whenever i add 2 or more pinMode into setup then wifi stops working. Does anyone know how to solve this ?

Note: Its working with 1 pinMode as its expected.

can you share your complete code??

Here it is:

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

char ssid[] = "iTech"; //  your network SSID (name)
char pass[] = "password";    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;            // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
IPAddress server(192,168,137,1);  // numeric IP for Google (no DNS)

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
WiFiClient client;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (status != WL_CONNECTED)
  {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    
    status = WiFi.begin(ssid, pass);
 
    // wait 10 seconds for connection:
    delay(1000);
  }
  Serial.println("Connected to wifi");
  printWifiStatus();
 
  Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:
  if (client.connect(server, 3300))
  {
    Serial.println("connected to server");
  }
  pinMode(2, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop() {
  

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

  // if the server's disconnected, stop the client:
  while (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting from server.");
    client.stop();
    if (client.connect(server, 3300))
      client.println("EBEN!!");
  }
  client.println("EBEN2!!");
}


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");
}

don't use pin 4,10,11,12. It's used by the shield.

Tried using 2,3 or 2,5 or 2,6 but still the same :S

If you don't read the server response, you will cause that socket to be locked up. Since the WiFi library only uses one socket, locking that one up seems like a really bad idea.

Do not use pinMode() or anything else on pins already in use by the WiFi shield.

Mark