How to get size of file on server?

  • Thread starter Thread starter Guest
  • Start date Start date
Might require a bit of trial and error, but you should be able to make the
HTTP GET request and then grab the Content-Length: attribute off the
server's header response without having to download the actual file...

Perhaps you could create a new TCP socket connection and connect to
www.virtualwareproducts.com on port 80, then once connection is established,
send:

GET /virtuadisk/virtuadisksetup.exe

Server should return something similar to this at the beginning:

Date: Sun, 02 Jan 2005 00:00:27 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 1515

Then only listen for a couple hundred bytes and parse Content-Length out of
it (regular expressions?), then terminate the connection.

HTH,
Brandon
 
Back
Top