AT24C256 EEPROM write failed

After some research on the information @cattledog gave me, I think I found what I did wrong.

Serial.read() reads only one byte at a time. So the control condition in my sketch

while(1){
            if(Serial.read()!="sendreq\n"){
              Serial.write("OK\n");
            }else if(Serial.read()!="EndOfData\n"){
               ended = true;
            }
            delay(50);
      }

just won't work as I expected.

I'm trying to fix this now, hope it turns well !