• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Event-driven sockets IO

yaronct

Lurker
I'd like to use sockets in my Android app in an event-driven way, that is to receive an event whenever an event happens on a socket, e.g. a connection succeeds or data is available for reading. Is there such a way? The alternative I've found is to use the java NIO classes SocketChannel and Selector. These can help me achieve non-blocking IO, and I can use them in a seperate thread. However I was wondering if can do without a seperate thread, but simply to receive socket events in the main thread.
 
Back
Top Bottom