I am making consecutive http get request to a PHP file on my server. The PHP is very simple and is as follows:
$con = mysql_connect('bla', 'bla', 'bla');
// retrieve required info from database
mysql_close($con);
echo $result;
These lines are from android code which sends get requests:
DefaultHttpClient client = new DefaultHttpClient();
HttpGet getRequest = new HttpGet(url);
HttpResponse getResponse = client.execute(getRequest);
At first glance, it seems that sql connection is opened and closed for each call on server side. This is not efficient since same client sends consecutive requests. So I want to keep connection open for same client until it stops sending get requests. Is this done automatically apachi/php/whatever or should I do something manually? There are similar questions but I just want to ask for my specific example. Since my objective is to listen a server, any recommendation (like a more efficient comet technique) is also welcomed…
Use mysql_pconnect