I am just wondering what could be the difference in the results of the following two approaches. I am trying to load a web page from www.oanda.com. One approach is to read from the input stream associated with URLConnection object. Another one is to use socket and send the following request to
the server
GET / HTTP/1.1
User-Agent: Simple Web Client
Host: localhost
Content-type: text/html
Connection: close
Content-length: 0
Accept: */*
The first one loads the page correctly while the second one returns just <HTML><HEAD></HEAD><BODY></BODY></HTML>. The pages from other servers that I've tried are loaded correctly. Therefore this is probably something specific to the server. I am wondering what could be the difference between the two approaches. (The ultimate objective is to send POST requests using socket thus any suggestions how to fix the socket are very welcome).