void loop() {
server.handleClient();
client.stop();
Doesn't matter that there might not be a client to stop, apparently. Here's a clue. It most certainly does.
while(Serial.available()==0) {
// delay(0); // try #2
}
On EVERY pass through loop(), wait, doing NOTHING, for there to be serial data to read.
Why on earth would you do THAT?
You haven't a clue how/when to read serial data. Get one. Serial input basics - updated