Android: what is an "Invalid file number" SocketException?

I get a "SocketException: Bad file number" when I try to read from a socket in an Android application, and I have no idea what that means. I looked for him and did not find any explanation of what it is. Any ideas? Thanks.

+4
source share
2 answers

This is usually the result of closing the closing socket. "Number" is due to the fact that file files in the base C file use file numbers to identify descriptors. A socket can be closed by you, but it can also be closed by security exceptions, flaky network, etc.

+4
source

Do you have something similar in your code?

httpClient.getConnectionManager().shutdown(); 

In my case, I had to disconnect my connectionManager AFTER receiving a response

0
source

Source: https://habr.com/ru/post/1347413/


All Articles