I have implemented HTTP server(handling GET. POST and DELETE requests) in Android using sockets. In order to make the server non-blocking, I saw there is
java.nio
package http://developer.android.com/reference/java/nio/package-summary.html. However, the selector keys are accept, read or write. Is there any example link or tutorial of how will I implement non-blocking server using nio for each of the methods mentioned?
Note: Http Core cannot be used as Android does not support org.apache.http.nio.*
Thanks in advance!
http://www.integratingstuff.com/2011/10/24/adding-a-webserver-to-an-android-app/ gives an example of Android Web server and link http://hc.apache.org/httpcomponents-core-ga/httpcore/examples/org/apache/http/examples/ElementalHttpServer.java explains multi-threaded server. As the number of clients is only 10, I used threading.