In iPhone there is Cocoa Asynchronous socket library. Is there a similar library in Java for Android? Can it be done using Java Asynchronous sockets(NIO library) or is there a way I can make use of NDK for Android and use native libraries for asynchronous sockets?
A:
Not as far as I know, but it does have the sockets capabilities you would expect from a a modern *nix, so you should be able to emulate this using either java or native code.
Probably you would create a thread to handle the sockets asynchronously which you would communicate with using messages and handlers; alternatively you could do this by creating an android service, either within your activity's process or in a separate one.
Chris Stratton
2010-09-23 05:24:20