Receiving and Sending to control Arduino over TCP/IP stack?

any examples based on networking as i would be using an app not the browser to send and receive info.

File->Examples->Ethernet->ChatServer
File->Examples->Ethernet->TelnetClient

basically this my code for the arudino that right now takes values from the UART serial and based on that an lED gets on with a specific color and i mainly want the instruction from LED to be received from an app

#include "SPI.h"
#include "WS2801.h"

/*****************************************************************************
Example sketch for driving WS2801 pixels
*****************************************************************************/

// Choose which 2 pins you will use for output.
// Can be any valid output pins.
// The colors of the wires may be totally different so
// BE SURE TO CHECK YOUR PIXELS TO SEE WHICH WIRES TO USE!
int dataPin = 2;
int clockPin = 3;
// Don't forget to connect the ground wire to Arduino ground,
// and the +5V wire to a +5V supply


// Set the first variable to the NUMBER of pixels. 25 = 25 pixels in a row
WS2801 strip = WS2801(240, dataPin, clockPin);

// Optional: leave off pin numbers to use hardware SPI
// (pinout is then specific to each board and can't be changed)
//WS2801 strip = WS2801(25);

    int led = 0;
    int r = 0;
    int g = 0;
    int b = 0;
    byte m = 0;
boolean commandReceived = false;
String inputString = "";



void setup() {
  
  Serial.begin(9600);
  strip.begin();
  strip.show();
  
}


void loop() {
 
  if (commandReceived)
  {
      strip.setPixelColor(led,r,g,b);
      strip.show();
      commandReceived = false;
      inputString = "";
  }
  
}


void serialEvent() 
{
    while (Serial.available()) 
    {
      char inChar = (char)Serial.read(); 
      inputString += inChar;
      if (inChar == '\n') 
      {
        if (inputString.length() > 12)
        {
          char cl[4];
          char cr[4];
          char cg[4];
          char cb[4];
          
         inputString.substring(0,3).toCharArray(cl,4);
         inputString.substring(3,6).toCharArray(cr,4);
         inputString.substring(6,9).toCharArray(cg,4);
         inputString.substring(9,12).toCharArray(cb,4);
//         Serial.println(inputString.substring(0,3));
//         Serial.println(inputString.substring(3,6));
//         Serial.println(inputString.substring(6,9));
//         Serial.println(inputString.substring(9,12));
//         Serial.println(cl[0]);
//         Serial.println(cl[1]);
//         Serial.println(cl[2]);
//          Serial.println(cl);
//          Serial.println(cr);
//          Serial.println(cg);
//          Serial.println(cb);
 
           led = atoi(cl);
          r =  atoi(cr);
         g =  atoi(cg);
          b =  atoi(cb);
          Serial.println(inputString);
//          Serial.println(led);
//          Serial.println(r);
//          Serial.println(g);
//          Serial.println(b);
          commandReceived = true;
          inputString="";
        }
      }
    }
  }

Im following folks from this place>> A simple internet server in an Arduino... but not a web server- art5simpsrv and using the folloing code with ID = 192,168,42,220(my pcs IP is 192,168,42,226) and i donot have a mac address because it didn't came up with my iTead iBoard but i have tested it with pachube/cosm.com it works excellent! with the default mac id

Arduino ITEAD iBoard with Ethernet W5100 sketch>>

//
// TCP004: A simple server... not a web server... for Arduino
//    Basic version. One command, one (static) response.
//    See TCP005 for expanded, "useful" version.
// The client software for this is TCP002 (See below)

// Ver: 04 Oct 2011

//    Requires purpose crafted client software.
//    TCP002.exe in....
//    http://sheepdogguides.com/zips/TCP001.zip
//    ... is suitable.
//    If you know of, or have written, Linux
//    equivalents, please contact http://sheepdogguides.com/
//
// See http://sheepdogguides.com/arduino/art5simpsrv.htm
//    for a guide to TCP004
//
// This code is in the public domain.
//
// It requires a W5100 based ethernet interface, although converting
//    the software to run with a Microchip ENC28J60 should not be hard.

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

//The following determine the MAC address and IP address
//   that will be in the ethernet shield on your Arduino.
//Both must be unique on your LAN

uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
uint8_t ip[] = {192,168,42,220};

//The following determines what port the server will listen on.
int iSPort = 5202;

Server server(iSPort);


//TKB: Write up Ethernet Pro issues: At Sparkfun page ANSWER the %v/3.3v? question, pointing out that Ethernet Pro
   //described as "Ethernet shield on an Arduino Pro" and that both 3v3 and 5v Pros sold!

   //Also discuss problem of BUB/Optiboot, and tell people to look at ModernDevice page, where things explained nicely for us!!

   //Also: BUB 3v3 // Ethernet Pro Gnd.... BUB's 3v3 NOT CONNECTED in SOME cases.

   //ARGHHH!

   //Ask about/ discuss c.stop.....

void setup() {
Serial.begin(9600);
Serial.print("entered");
  // Initialize the W5100 ethernet chip
  Ethernet.begin(mac, ip);

  // Start the serial library (for debug output)
  // The serial monitor is not required for the server's operation.
  

  // Start the TCP server
  Serial.print("Opening server...\n");
  server.begin();
}

void loop()
{
  Client c = server.available();
  if (c.connected()) {
    Serial.print("Incoming connection!\n");
    // Read two bytes from client
    uint8_t b1 = c.read();
    uint8_t b2 = c.read();
    // Debugging: Show me what the client sent
    Serial.print("The client said 0x");
    Serial.print(b1,HEX);
    Serial.print(" 0x");
    Serial.print(b2,HEX);
    Serial.print("\n");
    // Deal with the connection
    if ((b1 == 0xBB) and (b2==0x82)) {
      // N.B.. Maximum size of response is 68 bytes (enough for 32 sensors)
      uint8_t response[68];
      // Create a response
      uint8_t *r = response;
      *r++ = 0xBB;
      *r++ = 0x82;
      *r++ = 0x01;
      *r++ = 0x01;
      *r++ = 0xFF;
      *r++ = 0xFF;
      // Send it

      c.write(response,r-response);
    };
    // Close the connection... TKB: close connection or stop server? Don't want latter!
    //TKB REMMED OUT, as CONNECTION REPEATEDLY CLOSED...
    //c.stop();
    //seems to work! (Didn't (properly) with c.stop... server shut down?
  };//end of Loop()

}

The problem is that with the ATTACHED software which serves as a client to this server software always shows error!! where im wrong or is there an alternate way using the browser or some other software to connect to the arduino server??

I got a solution but my server code on arduino does not seems to work. and im using a c# console app to send values to the server.

Arduino server code:

/*
 Chat  Server
 
 A simple server that distributes any incoming messages to all
 connected clients.  To use telnet to  your device's IP address and type.
 You can see the client's input in the serial monitor as well.
 Using an Arduino Wiznet Ethernet shield. 
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)
 
 created 18 Dec 2009
 by David A. Mellis
 modified 10 August 2010
 by Tom Igoe
 
 */

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,4);
IPAddress gateway(192,168,1,1);
IPAddress subnet(255,255,0,0);

// telnet defaults to port 23
EthernetServer server(23);
boolean gotAMessage = false; // whether or not you got a message from the client yet

void setup() {
  // initialize the ethernet device
  Ethernet.begin(mac, ip, gateway, subnet);
  // start listening for clients
  server.begin();
  // open the serial port
  Serial.begin(9600);
}

void loop() {
  // wait for a new client:
  EthernetClient client = server.available();
  
  // when the client sends the first byte, say hello:
  if (client) {
    if (!gotAMessage) {
      Serial.println("We have a new client");
      client.println("Hello, client!"); 
      gotAMessage = true;
    }
    
    // read the bytes incoming from the client:
    char thisChar = client.read();
    // echo the bytes back to the client:
    server.write(thisChar);
    // echo the bytes to the server as well:
    Serial.print(thisChar);
  }
}

C# code:

/*       Client Program      */

using System;
using System.IO;
using System.Net;
using System.Text;
using System.Net.Sockets;


public class clnt
{

    public static void Main()
    {

        try
        {
            TcpClient tcpclnt = new TcpClient();
            Console.WriteLine("Connecting.....");

            tcpclnt.Connect("192.168.1.4", 80);
            // use the ipaddress as in the server program

            Console.WriteLine("Connected");
            Console.Write("Enter the string to be transmitted : ");

            String str = Console.ReadLine();
            Stream stm = tcpclnt.GetStream();

            ASCIIEncoding asen = new ASCIIEncoding();
            byte[] ba = asen.GetBytes(str);
            Console.WriteLine("Transmitting.....");

            stm.Write(ba, 0, ba.Length);

            byte[] bb = new byte[100];
            int k = stm.Read(bb, 0, 100);

            for (int i = 0; i < k; i++)
                Console.Write(Convert.ToChar(bb[i]));

            tcpclnt.Close();
        }

        catch (Exception e)
        {
            Console.WriteLine("Error..... " + e.StackTrace);
        }
    }

}

//

The c# console shows connected but the Serial window on Arduino IDE is al blank always even when i send stuff from client.