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

后端 未结 6 2009
臣服心动
臣服心动 2020-11-27 18:45

I looking to create a login form for an android application. I want to use a post method to send information to the server side where it is handle by a PHP file; which in tu

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 19:24

    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.

提交回复
热议问题