The main problem I'm having is that, when i try to make a get request on Instagram, averagely i get 250 ms delay. The same call on iOS gets around 50 ms. How can I decrease the delay ?
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.connect();
BufferedReader reader = new BufferedReader(new InputStreamReader( urlConnection.getInputStream()));
char[] buf = new char[2048];
int charsRead;
while((charsRead = reader.read(buf, 0, 2048)) > 0) {
response.append(buf, 0, charsRead);
}
reader.close();
urlConnection.close();
I have tried StringBuilder, HttpGet with HttpResponse( gives the worst delay, 350 ms). Sorry for my English and thanks in advance !
No comments:
Post a Comment