Introduction
Submitted by jeffheaton on Wed, 01/09/2008 - 22:22
- The HttpURLConnection Class
- Reading HTTP Response Headers
- Setting HTTP Request Headers
- Managing HTTP Timeouts
The connection between a bot and a web server is very important. In the previous chapters this link was established using either a Socket object or an InputStream object, obtained from a call to the openStream function of a URL class. There is a third way to open a connection to a web server?you can use the HttpURLConnection object. In summary, the three ways to open a connection to a web server are:
- Socket
- InputStream from URL.openStream
- HttpURLConnection
The HttpURLConnection class allows much more flexibility than just using an InputStream object. It is also much simpler to use than a socket.












