arduino ethernet server, TClientSocket

Hi,

I made an ethernet server on the arduino , and a client application in Borland C++ Builder using the TClientSocket.
When I try to connect to the server, Borland sees a connection but no server socket information.
Arduino doesn’t see a connection at all. Borland enters the ‘ClientSocketConnect’ function but displays no Host info

Arduino Code :
#include <SPI.h>
#include <Ethernet.h>

#define debug 1

const int analogInPin = A15; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int IdleValue = 0; // value read from the pot
double IdleVoltage;
int outputValue = 0; // value output to the PWM (analog out)
int battVolts; // Battery Voltage for Reference
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Set Mac Address of Arduino Chat Client
IPAddress ip(192,168,0,103); // Set IP address of Arduino Chat Client
IPAddress gateway(192,168,0, 1);// Set IP address of Gateway
IPAddress subnet(255, 255, 255, 0);// Set the IP Address of the Chat server
EthernetServer server(1024); // Server Socket Port
boolean alreadyConnected = false;
char Buffer[50]; // TextBuffer
char x; // counter

void setup()
{ Ethernet.begin(mac, ip, gateway, subnet); // initialize serial communications at 9600 bps:
server.begin(); // Start Server
Serial.begin(9600); // Start Serial
battVolts=getBandgap(); // ADC Reference
}

void loop()
{ EthernetClient client = server.available();// Wait for Client to connect
while (client == 0) // Wait for Client
{
#ifdef debug
Serial.println(“Waiting client”);
#endif
delay(500);
EthernetClient client = server.available(); // Code Loops in this While!!!
}
client.flush(); // Clear Buffer

IdleValue =0;
for(x=0;x<20;x++) // read the analog in value 20x
{ IdleValue += analogRead(analogInPin);
delay(10);
}
IdleValue=IdleValue/20; // Average Out
IdleVoltage=map(IdleValue, 0, 1023, 0, battVolts);
// TODO :
// switch Load on
// Measure ADC under Load
#ifdef debug
Serial.print(“Idle Value = " );
Serial.print(IdleVoltage/100);
Serial.print(”\n");
#endif
if (client.available() > 0)
{ sprintf(Buffer,“Idle Value = %d”,IdleVoltage);
client.println(Buffer);
#ifdef debug
Serial.print(“Written to server :” );
Serial.print(Buffer);
#endif
}
delay(500); // Stay a while
}

/---------------------------------------------------------------/
/* FUNCTIONS /
/
---------------------------------------------------------------*/
int getBandgap(void) // Returns actual value of Vcc (x 100)
{
#if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
// For mega boards
const long InternalReferenceVoltage = 1115L; // Adjust this value to your boards specific internal BG voltage x1000
// REFS1 REFS0 → 0 1, AVcc internal ref. -Selects AVcc reference
// MUX4 MUX3 MUX2 MUX1 MUX0 → 11110 1.1V (VBG) -Selects channel 30, bandgap voltage, to measure
ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR)| (0<<MUX5) | (1<<MUX4) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
#else
// For 168/328 boards
const long InternalReferenceVoltage = 1056L; // Adjust this value to your boards specific internal BG voltage x1000
// REFS1 REFS0 → 0 1, AVcc internal ref. -Selects AVcc external reference
// MUX3 MUX2 MUX1 MUX0 → 1110 1.1V (VBG) -Selects channel 14, bandgap voltage, to measure
ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
#endif
delay(50); // Let mux settle a little to get a more stable A/D conversion
ADCSRA |= _BV( ADSC ); // Start a conversion
while( ( (ADCSRA & (1<<ADSC)) != 0 ) ); // Wait for it to complete
// Scale the value
int results = (((InternalReferenceVoltage * 1023L) / ADC) + 5L) / 10L; // calculates for straight line value
return results;
}

Borland Code
void __fastcall TChatForm::FileConnectItemClick(TObject *Sender)
{
if (ClientSocket->Active)
{
Shape1->Brush->Color=clSilver;
ClientSocket->Active = false;
}
else
{ Server=Edit1->Text; // Contains the server IP 192.168.0.103 port is set to 1024
if (Server.Length() > 0)
{ ClientSocket->Host = Server;
ClientSocket->Active = true;
}
}
}

//---------------------------------------------------------------------------
void __fastcall TChatForm::ClientSocketConnect(TObject *Sender,
TCustomWinSocket *Socket)
{ StatusBar1->Panels->Items[0]->Text = "Connected to: " + Socket->RemoteHost; // Connected To appears in statusbar
Shape1->Brush->Color=clBlue; // RemoteHost is empty
if(AudioOn==1) PlaySound(“BLEEP14.WAV”,0,0);
}

Any Idea what I am doing wrong?
Thanks.

Any Idea what I am doing wrong?

Not reading #7 below?

http://forum.arduino.cc/index.php/topic,148850.0.html