WiFiClient and ports > 1024

Hi,

I have hooked up a push button to an Arduino Uno R3 with an Arduino WiFi shield, and for some reason the WiFiClient simply will not connect to any port above 1024.

I have updated the firmware to v1.1.0, and have used the Arduino IDE v1.0.2 and the latest version (v 1.0.6), still with no luck. It will connect to any open port below 1024 (I tried it with port 80 and port 22, both connected instantly), the problem is I need it to connect to a port above 1024 due to security restrictions within Adobe Air (any ServerSocket must be run on a port above 1024, unless it’s run with root privileges, which I can’t do in this context).

I don’t think it’s a firewall/network problem, as I can open a socket (using telnet) to the Air app when it has port 3307 open from multiple computers. I’ve tried dozens of ports (1025, 6000, 8000, 8001, 3307, 3000, you name it)

I’ve used a packet analyzer on the destination computer and none of the requests from the Arduino are being received.

Has anyone else had this problem? Does the Ethernet client work with ports above 1024?

Here is the code:

#include <WiFi.h>

const int buttonPin = 2;
int buttonState;
long lastDebounceTime = 0;
long debounceDelay = 50; 
int lastButtonState = LOW;

WiFiClient client;
char* ssid = "xxxxxx";
char* password = "xxxxxxx";
IPAddress ip(10, 71, 107, 194);
int port = 3307;

void setup() {
 Serial.begin(115200);
 pinMode(buttonPin, INPUT); 
 
 connectToNetwork(ssid, password);
 wifiStatus();
}

void loop() {
  int buttonValue = digitalRead(buttonPin); 
  if (buttonValue != lastButtonState) {
    lastDebounceTime = millis(); 
  }
  
  if ((millis() - lastDebounceTime) > debounceDelay) {
    if (buttonValue != buttonState) {
      buttonState = buttonValue;
      
      // only toggle the LED if the new button state is HIGH
      if (buttonValue == HIGH) {
        Serial.println(F("Button pressed"));
        connect(ip, port);
      }
    }
  }
  
  lastButtonState = buttonValue;
}




void connectToNetwork(char* ssid, char* password) {
	int status = WL_IDLE_STATUS;

	while (!Serial) {
		; // wait for serial port to connect. Needed for Leonardo only
	}
	
	// check for the presence of the shield:
	if (WiFi.status() == WL_NO_SHIELD) {
		Serial.println(F("WiFi shield not present")); 
		// don't continue:
		///return;
		while(true);
	} 
	
	// Attempt to connect to Wifi network:
	while (status != WL_CONNECTED) { 
		// Attempt to connect to a predefined network first
		Serial.print(F("Connecting to SSID: "));
		Serial.println(ssid);
		Serial.print(F("Password: "));
		Serial.println(password);

		if (status != WL_CONNECTED) {
				// Connect to WPA/WPA2 network.
			status = WiFi.begin(ssid, password);
			
			// Just give it a chance
			delay(3000);
		}
	}
}


void wifiStatus() {
	// Get the local IP
	IPAddress ip = WiFi.localIP();
	IPAddress gateway = WiFi.gatewayIP();
	long rssi = WiFi.RSSI();
	Serial.print(F("IP: "));
	Serial.println(ip);
	Serial.print(F("Gateway: "));
	Serial.println(gateway);
	Serial.println(F("Connected to wifi"));
	Serial.print(F("Signal strength (RSSI):"));
	Serial.print(rssi);
	Serial.println(F(" dBm"));void wifiStatus() {
	// Get the local IP
	IPAddress ip = WiFi.localIP();
	IPAddress gateway = WiFi.gatewayIP();
	long rssi = WiFi.RSSI();
	Serial.print(F("IP: "));
	Serial.println(ip);
	Serial.print(F("Gateway: "));
	Serial.println(gateway);
	Serial.println(F("Connected to wifi"));
	Serial.print(F("Signal strength (RSSI):"));
	Serial.print(rssi);
	Serial.println(F(" dBm"));
        Serial.print(F("Firmware version: "));
        Serial.println( WiFi.firmwareVersion());
}

void connect(char server[], int port) {
   if (client.connect(server, port)) {
     Serial.println(F("Connected"));
   }
   else {
     Serial.println(F("Could not connect"));
   }
   client.flush();
   client.stop();
}

void connect(IPAddress ip, int port) {
   if (client.connect(ip, port)) { 
     Serial.println(F("Connected"));
   }
   else {
     Serial.println(F("Could not connect to IP address"));
   }
   client.flush();
   client.stop();
}

The wifi shield I am using connects to a server using port 8088. I'm using firmware v1.1.0 and IDE v1.0.6.