Monday, May 12, 2014

Android LocalServerSocket cannot handle more then 1024 connects/disconnects

For last couple of days I have been trying to fix one serious issue in my app. In Android 4.4.2 a client cannot connect /disconnect to server (created using LocalServerSocket Domain UNIX Socket)  more than 1024 times. How fucked up is that ?

I have uploaded my demo code here

I have posted questions on StackOverflow here

and Google

Still got nothing!.

After few hours of pulling my hair out, I remembered Jackpal terminal emulator had some code to close the file descriptor. So I decided to take a look there.

If you pass the client socket file descriptor to his close function. it closes the connection. However it leaves a error on LogCat.

Please let me know if someone found a better solution.

No comments:

Post a Comment