PULSE IN TRANSMISSION using Ethernet shield IS IT POSSIBLE?

Hi there,

I am using this piece of code, which works great while using serial communication, but when I tried to use Ethernet communication, it crashes while loading the webpage, never loads the webpage, and only happens when I use this piece of code:

I am using currently an Arduino Mega 2560 and an Ethernet Shield.

VARIABLE DECLARATION

int r; //counter cnyRot
int pin=2; //input CNYROT
unsigned long duration,prom=0;

VOID SETUP
pinMode(pin,INPUT);

VOID LOOP
//TO FIX
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//CNYROT
client.println(“

CNY ROT

”);
//client.println("
");
client.println(“esta cosa es la unica que no funciona”);

// for(r=0;r<=100;r++){
// duration = pulseIn(pin, HIGH)+120;
// //Serial.print(“Tiempo Positivo_”);
// prom=prom+duration;
// client.println(prom);
//
// }// FOR
// prom=prom/100;
// Serial.println(prom);
// client.println(prom);
// prom=0;
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////

I have a FOR and a PROM in order to get an average, and the +120 is help aswell.

This code can not run using ETHERNET connection, if anyone knows a way to get it to work,
I will appreciate a lot,

Your post doesn't make a lot of sense.
Please feel free to use the "modify" control on it.