Arduino Led On/Off on Ethernet not working

I am trying to On/Off a led from desktop app on C# to Arduino using Ethernet (for serial port communication works), I am connecting to an IP Address to communicate with Arduino, but it looks something wrong with my code or my sketch for Arduino. (I am working with Ethernet shield) my code Arduino

[code]//////////INCLUDE HEADER FILES //////////////////
#include <Ethernet.h>
#include <SPI.h>
#include <EEPROM.h>
#include <LiquidCrystal.h>
#include <SD.h>
#include <Wire.h>

EthernetServer server(23 );
String content;
File myFile;
int ledPin = 7;
int  outputpin = 0;
void setup()
{
  IPAddress ip( 192, 168,1,110);
  byte mac[] = { 
    0xDE,0xAE,0xBE,0xEF,0xFE,0xED
  };

  Ethernet.begin( mac, ip );
  server.begin();
  if ( ! SD.begin( 4 ) ) 
  {
    return;
  }

  Serial.begin(9600);
}

void loop()
{
  waitIncommingConnection();                                                             
}

void waitIncommingConnection()
{

  String pwd            = "";
  String inData         = "";
  EthernetClient client = server.available();

  if ( client  )
  {
    while ( client.connected() ) 
    {      
      if ( client.available() > 0)
      { 
        char recieved = client.read();
        inData += recieved;                       
        if (recieved == '\n')
        {                           
          switch( inData[0] )
          {                            
            case (char)'o' : 
              client.println("o");
              digitalWrite(ledPin, HIGH);
            break;

            case (char)'f' :
              client.println("f");
              digitalWrite(ledPin, LOW);

            break;

            case (char)'*' :
              Logout(client);  
            break;

            default:
               client.println('d');
            break;
          }
          inData = ""; 
        }

      }
    }
  }
  else
  {
   client.println('v');
  }
}

void Logout(EthernetClient client )
{ 
  client.print('x');
  client.stop(); 

}

[/code]
My C# code

public partial class Form1 : Form
{
    public Client client;
    public delegate void FeedBackCallback(string text);
    public delegate void UpdateMessageBoxCallback(string text);

    public Form1()
    {
        InitializeComponent();
    }

    private void connect_Click(object sender, EventArgs e)
    {
        string ipAddr = ip1.Text + "." + ip2.Text + "." + ip3.Text + "." + ip4.Text;
        string port = portInput.Text;

        if (IsValidIPAddress(ipAddr) == true)
        {
            try
            {
                if (client == null)
                    client = new Client(this);

                client.Connect(ipAddr, port);
                //  client.Send(Encoding.GetEncoding(Constant.EncodingFormat).GetBytes("c"+'\n'));
                disconect.Enabled = true;
                connect.Enabled = false;
                on.Enabled = true;
            }
            catch (SocketException se)
            {
                MessageBox.Show("Unable to Connect.\r\n" + se.ToString());
            }
        }
        else
        {
            MessageBox.Show("Invaild Ip Adrress", "Invaild Ip Adrress", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }

    private bool IsEmptyUserNamePasswordFields(string userName, string password)
    {

        if (userName.Length == 0 || password.Length == 0)
        {
            MessageBox.Show("Password and Username field is required!", "Required Fileds Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return false;
        }
        else
        {
            return true;
        }
    }

    private bool IsValidIPAddress(string ipaddr)//Validate the input IP address
    {
        try
        {
            IPAddress.Parse(ipaddr);
            return true;
        }
        catch (Exception e)
        {
            return false;
        }
    }

    private void on_Click(object sender, EventArgs e)
    {
        disconect.PerformClick();
        connect.PerformClick();
        try
        {
            if (client == null)
                client = new Client(this);
client.Send(Encoding.GetEncoding(Constant.EncodingFormat).GetBytes("o" + '\n'));
            off.Enabled = true;
            on.Enabled = false;
        }
        catch (SocketException se)
        {
            MessageBox.Show("Unable to Connect.\r\n" + se.ToString());
        }
    }

    private void off_Click(object sender, EventArgs e)
    {
        disconect.PerformClick();
        connect.PerformClick();
        try
        {
            if (client == null)
                client = new Client(this);
client.Send(Encoding.GetEncoding(Constant.EncodingFormat).GetBytes("f" + '\n'));
            on.Enabled = true;
            off.Enabled = false;
        }
        catch (SocketException se)
        {
            MessageBox.Show("Unable to Connect.\r\n" + se.ToString());
        }
    }

    private void disconect_Click(object sender, EventArgs e)
    {
        connect.Enabled = true;
        disconect.Enabled = false;
        client.Disconnect();
    }
}

images for the Arduino


I don’t know where is my problem, the app connect to the arduino, but the On/Off button not works for the led. if u want to see the code foe serial port communication this is the link here, Serial Port

            case (char)'o' :

It boggles the mind why anyone would cast a char as a char. What IS the point?

Why does the Arduino as server bother sending anything to the client? Or, why does the client not bother to read what the server says?

Why doesn't the Arduino use Serial.begin() and Serial.print()? Debugging by guessing is incredibly hard. Debugging by posting on the internet is lazy. Debugging be Serial.print()ing is the ONLY way.

PaulS:             case (char)'o' :

It boggles the mind why anyone would cast a char as a char. What IS the point?

Why does the Arduino as server bother sending anything to the client? Or, why does the client not bother to read what the server says?

Why doesn't the Arduino use Serial.begin() and Serial.print()? Debugging by guessing is incredibly hard. Debugging by posting on the internet is lazy. Debugging be Serial.print()ing is the ONLY way.

So have any other code to send get/send data over Ethernet without serial communication? and I ask why my code not working

So have any other code to send get/send data over Ethernet without serial communication?

Your code may, or may not, be sending data over ethernet, without serial communication.

There is NOTHING stopping you from using serial communication AT THE SAME TIME, so you can debug your program. Well, there is cluelessness, but there isn't much we can do about that.

PaulS: There is NOTHING stopping you from using serial communication AT THE SAME TIME, so you can debug your program. Well, there is cluelessness, but there isn't much we can do about that.

ok thnx :)