The setup() method is executed at once. You send a request and immediately try to get the answer, but it will take a while before the server answers, so the response isn't available right now.
That's why Client example put the code in draw(), because it can scan regularly if there is a response.
Just add noLoop() after you get the response, and you have the best of both worlds. Alternatively, you can spawn a new thread to poll the response, but you will just do the same work than draw()...
That's why Client example put the code in draw(), because it can scan regularly if there is a response.
Just add noLoop() after you get the response, and you have the best of both worlds. Alternatively, you can spawn a new thread to poll the response, but you will just do the same work than draw()...