Server in Java(Http/sockets)
<p>I want to build an Http Server which will serve the requests of a chat application in android. Because i am really confused... in my code I have to use sockets? How can i make the client to communicate with the server? Which is the code i have to add in the server in order to accept the requests from the client and respond to them? The code I use in the client is the following:</p>

<pre><code>DefaultHttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://localhost:80");
List&lt; BasicNameValuePair &gt; nvps = new ArrayList&lt; BasicNameValuePair &gt;();
nvps.add(new BasicNameValuePair("username", username1));
nvps.add(new BasicNameValuePair("password", password1));
try {
    UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps, HTTP.UTF_8);
    httppost.setEntity(p_entity);

          //Execute HTTP Post Request
          HttpResponse response = client.execute(httppost);
          Log.v(TAG,"something");
          Log.v(TAG, response.getStatusLine().toString());
          HttpEntity responseEntity = response.getEntity();
</code></pre>

<p>Please I really need an answer. Thank you!!!</p>
