meteoritepanama
meteoritepanama

Reputation: 6252

Android: What is a "Bad file number" SocketException?

I'm getting a "SocketException: Bad file number" while attempting to read from a socket in an Android app and I have no idea what this means. I've googled it and haven't found any explanation of what it is. Any ideas? Thanks.

Upvotes: 4

Views: 6387

Answers (2)

user865197
user865197

Reputation: 179

Do you have something like this in your code ?

       httpClient.getConnectionManager().shutdown();

In my case, I had to shutdown my connectionManager AFTER getting the response

Upvotes: 0

Sajid
Sajid

Reputation: 4421

This is usually the result of the underlying socket being closed. The "number" is because file handles in the underlying C code use file numbers to identify handles. The socket may be closed by you, but it may also be closed by security exceptions, flaky network, etc.

Upvotes: 4

Related Questions