[HELP]Ultrasonic sensor and motorShield.

It is reading the data, I am able to connect to it trough VB.NET. But nothing happens.
Thanks in advance.

//*************************************************************************************************************************************
// Declarations
//*************************************************************************************************************************************
#include <SPI.h>
#include <Ethernet.h>

//*************************************************************************************************************************************
// Wired configuration parameters
//*************************************************************************************************************************************
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xD1, 0x4B };
unsigned char local_ip[] = {192,168,1,5};	// IP address of WiShield
unsigned char gateway_ip[] = {192,168,1,1};	// router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0};	// subnet mask for the local network
int E1 = 8;  
int M1 = 9; 
int E2 = 6;                      
int M2 = 7;  
const int trigPin = 12;
const int echoPin = 13;

EthernetServer server(80);

//char buffer[20];
String buffer = "";

void setup()
{
  pinMode(M1,OUTPUT);
  pinMode(M2,OUTPUT);
  Ethernet.begin(mac, local_ip);
  Serial.begin(9600);
}

void loop()
{
  long afstan;
  EthernetClient client = server.available();
  afstan = afstand();
  if (client) 
  {
    boolean currentLineIsBlank = true;  
    while (client.connected()) 
    {
      if (client.available()) 
      {
        char c = client.read();
          if (afstan < 10) 
          {
            Serial.print(c);
                analogWrite(E1, 0);   //PWM Speed Control
                analogWrite(E2, 0);   //PWM Speed Control   
            } 
      else { 
        switch (c) {
          case 'v':
                  digitalWrite(M1,HIGH);  
                  digitalWrite(M2, HIGH);       
                  analogWrite(E1, 255);   //PWM Speed Control
                  analogWrite(E2, 255);   //PWM Speed Control   
                  break;   
          case 'a':
                  digitalWrite(M1,LOW);  
                  digitalWrite(M2, LOW);       
                  analogWrite(E1, 255);   //PWM Speed Control
                  analogWrite(E2, 255);   //PWM Speed Control   
                  break; 
          case 'r':
                  digitalWrite(M1,LOW);  
                  digitalWrite(M2, HIGH);       
                  analogWrite(E1, 255);   //PWM Speed Control
                  analogWrite(E2, 255);   //PWM Speed Control   
                  break; 
          case 'l':
                  digitalWrite(M1,HIGH);  
                  digitalWrite(M2, LOW);       
                  analogWrite(E1, 255);   //PWM Speed Control
                  analogWrite(E2, 255);   //PWM Speed Control   
                  break; 
          case 's':
                  analogWrite(E1, 0);   //PWM Speed Control
                  analogWrite(E2, 0);   //PWM Speed Control  
                  break;        
        }
      }
    }
  }
}
}

long afstand(){
  
  long duration,cm;
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
 
  // convert the time into a distance
  cm = microsecondsToCentimeters(duration);
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();
  return cm;
  }
  
 
long microsecondsToCentimeters(long microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

It is reading the data

What is?

I am able to connect to it trough VB.NET.

How?

But nothing happens.

And the problem is?

How are we supposed to know what you are asking the server to do? How are we supposed to know what the server actually does?

      if (client.available()) 
      {
        char c = client.read();
          if (afstan < 10) 
          {
            Serial.print(c);
                analogWrite(E1, 0);   //PWM Speed Control
                analogWrite(E2, 0);   //PWM Speed Control   
            } 
      else { 
        switch (c) {
          case 'v':
                  digitalWrite(M1,HIGH);

You get the prize for crappiest indenting today. Congratulations.

Now, go learn what Tools + Auto Format does.