i already tried with an "if(client.available() == 0) delay(500);" but i assume the servers not connected and i dont know how to initialize the connection
That approach is ass-backwards. Instead of waiting for a client connection, like a blind date, to show up, do something when the client (blind date) does show up. Meanwhile, you can do other things.