Me again, sorry for the constant flow of questions...
# android
c
Me again, sorry for the constant flow of questions ! 🤯 I'm using HttpUrlConnection in conjunction with coroutines to send requests to my API. I click like a savage on my button, I manage to crash with that message:
Caused by: java.io.IOException: unexpected end of stream on com.android.okhttp.Address@...
. I am guessing that because of the multiple requests to HttpUrlConnection, opening and closing the input/output streams, at some point I am accessing a stream when the app has not closed it, or it is closing it when I am in the middle of accessing it. I am running the function as a
runBlocking (<http://Dispatchers.IO|Dispatchers.IO>) { // BLOCK that opens/closes the stream then closes the UrlConnection // }
though. What is the best way to prevent that? Will using actors to dispatch the requests change anything? Any idea what I could do to prevent that? I don't really know if there is a Kotlin/Android way which could help me there.