In iPhone there is Cocoa Asynchronous socket library. Is there a similar library in Java for Android? Can it be done using Java Asynchr开发者_如何学Conous sockets(NIO library) or is there a way I can make use of NDK for Android and use native libraries for asynchronous sockets?
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.
精彩评论