unity-simple-http icon indicating copy to clipboard operation
unity-simple-http copied to clipboard

Null Response vs Error 0

Open Estecka opened this issue 7 years ago • 1 comments

A while ago, I tested our project's error handling by completely disconnecting my computer from internet. In this scenario, all responses returned by SimpleHTTP would be null; I just accepted this was its way of saying "Server did not respond" and made sure to catch it.
However right now, we've been facing responses that are not null, but still came with an empty body a,d a Status Code of 0, and all other sources I found say that 0 is also what usually means that the server did not respond.

I'm still trying to figure out what causes these Status 0 to happen, so I'd like to know, what is the difference between a null response and a response with Status 0 ?

Estecka avatar Dec 13 '18 09:12 Estecka

I got a clear idea of what caused this, but I still don't know why it causes this :

For the sake of optimization, I had decided to store one Client object in a static variable, and use this single Client for every request. Going back to creating a Client object for every request fixed the issue.

Why does it not work when using a shared Client object? Is there maybe something that prevents it from running multiple requests at once ?
For precision in my original posts: null responses happened when the device was disconnected from internet, but Error Code Zero happened when I expected the request to fully succeed.

Estecka avatar Jan 04 '19 11:01 Estecka