URLConnection or HTTPClient: Which offers better functionality and more efficiency?

I believe in this case it’s up to whichever API you find more natural. Generally, HTTPClient is more efficient inside a server side application (or maybe batch application), because it allows you to specify a multithreaded connection pool, with a max number of total connections, and a max per host connection count (which ensures concurrent connections to the same host don’t get serialized (a problem with HttpUrlConnection)). But in an android app, you’ll probably only be making a single connection at a time, so this doesn’t matter.

Leave a Comment