EthernetClient client = server.available(); was declared inside loop
I see. You have to be in run-time to declare the object, at least that way.
I don't know the library so the best I can think is to see how they do it in examples.
Next best, I might declare/create the object as static and use a global pointer to address it but that's clunky.