How to implement an HTTP server on android

KhanZeeshan picture KhanZeeshan · Sep 1, 2011 · Viewed 14.8k times · Source

I've two android applications on same LAN provided by WIFI :

  1. App (A) that open a listening socket on port 8033
  2. App (B) that use HttpClient to access (A) on port 8033

How to make it possible that (A) may do POST and GET requests on (B)?
What the URL used by (A) to access (B) looks like ?

Thanks to All.

Answer

Emmanuel Devaux picture Emmanuel Devaux · Sep 1, 2011

You may confuse two different level of networking communication.

Level 4 : TCP connection between two sockets.
A logical pipe between to side (may be single(two process?) or two different computers) only connection handling data are handle at this level

Level 7 : Browser / Application Server used particular communication "language" to exchange high level data (file , images, audio ..) and is handled at this level.

Your question is about to open a Listening Socket (level 4) and a client that talk with it with a HTTP protocol (level 7).

So you're miss to fill the gap socket listening side to handle HTTP protocol
May be a java web server implementation may help you.