大龙的博客

常用链接

统计

最新评论

Question about URLConnection

I have found that class "URLConnection" has methods to establish a connection, for example, method "openConnection" and method "connect". But I have not found any methods of this class which are dealing with disconnect. I am wondering if I use class "URLConnection" to establish an HTTP connection to a remote host, what is the correct, clean and efficient approach to disconnect from remote host or close the connection.

1) for HTTP why not use HttpURLConnection instead?
2) HTTP is a stateless protocol meaning the server will close the connection for you.
3) if you close all streams you get from the URLConnection the connection is gone.


posted on 2011-09-23 05:22 大龙 阅读(225) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理