Qore Programming Language

  • Increase font size
  • Default font size
  • Decrease font size

qget example

E-mail Print PDF

The qget example script is meant to demonstrate Qore's event support.  Classes monitored by this script are Socket, HTTPClient, FtpClient, and File.

It is not intended to be a replacement for "wget", which is a much better and more complete program (with undoubtably better socket handling). 

Basically Qore provides relatively high-level access to socket functions through the above-listed classes.  The event mechanism allows the program to be informed about the details of socket-level actions, however without actually having control over them.

It would be possible to duplicate the functionality in this script using just functionality from the Socket class without using qore events, but would require on the order of 2 or more levels of magnitude more code to be written.

One glaring weakness of the design of this script is that it reads all the data into memory and then saves the data to a file; support for pipelining I/O tasks is planned to be added to the next major release of qore so that data read from any I/O source (in this case the network) can be streamed directly to another I/O handler, which in this case will be a file writer, so the file can be written as it is being read.

However, for now this script just demonstrates Qore's event support.

Another weakness is that this script does not try to determine the size of the terminal window and format the output accordingly; it uses a fixed output size.

Here is the source: qget

Last Updated on Wednesday, 03 December 2008 19:19