Here is my network handler: https://gist.github.com/anonymous/22fc110ad126ef3a2c5f
The problem is that when data is received it blocks my animiation (I have a wheel spinning when data has been requested) so it looks like the app have crashed and then after 1 second or 2, when the data has been received, it works like a charm.
This line seems to make sure that when waiting for an answer the app doesn't freeze:
local input,output = socket.select( { self.sock }, nil, 0 ) -- this is a way not to block runtime while reading socket. zero timeout does the trick
Here is another timeout setting:
self.sock:settimeout(0)
I have tried to change them to 0.01 and 0.001 but with no luck. I'm not really sure how to make it so the animation doesn't freeze.
Maybe I should change to one of Coronas built in async network handler (with callback functions) or is it possible to modify this network handler so that the animation doesn't freeze?