Can not chat in two directions using Arduino Ethernet Shield, why?

Take a look at the code in this thread:

It is a simple telnet type connection that works both ways. It is by no means complete, just a test. But it should give you an idea how it works. Feel free to modify it to your heart's content.

edit: That code above is a bit lacking. Try this. It is a bit better for two way comm. Change the network settings to yours. It will timeout the connected client if there is no input for about a minute.

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip( 192,168,2,2 );
IPAddress gateway( 192,168,2,1 );
IPAddress subnet( 255,255,255,0 );

EthernetServer server(23);

int loopCount = 0;
boolean isStopped;

void setup()
{
  Serial.begin(9600);
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  delay(2000);
  server.begin();
  Serial.println("Ready");
}

void loop()
{
  EthernetClient client = server.available();

  if(client)
  {
    Serial.println("Client connected");
    client.flush();
    isStopped = false;
    loopCount = 0;
    char c;
    
    client.println("Hello");

    while(Serial.available()) Serial.read();
    
    while (client.connected()) 
    {
      while(client.available()) 
      {
        c = client.read();

        if(c == 'x')
        {
          client.stop();
          Serial.println("stop - user request");
          isStopped = true;
        }
        else Serial.write(c);

        loopCount = 0;
      }

      delay(10);
      
      loopCount++;

      if(loopCount > 10000)
      {
        client.stop();      
        Serial.println("stop - timeout");
        isStopped = true;
      }

      while(Serial.available())
       {
          c =Serial.read();
          client.write(c);
          Serial.write(c);
       }
    }

    if(!isStopped)
    {
      client.stop();
      Serial.println("stop - disconnect");
    }    

    Serial.println("disconnected");
  }
}