The K Desktop Environment

Chapter 1. Introduction

The K Desktop Environment (KDE) I/O slaves (ioslaves) are a series of small programs that have intimate knowledge on working with a very specific protocol. For instance, the HTTP ioslave (kio_http) knows all about sending and receiving data to and from a web server. It knows all about SSL, encoding, and what all of the different header fields mean. It knows this so that KDE developers won't have to -- if they want a web page, they merely have to use kio_http for it and it will take care of everything for them.

The ioslaves are based on the KIO library (libkio). This library implements a method of asynchronous communication between applications as well as provides a "protocol registry" of sorts. This has many advantages. Two of the major ones are:

Here is a fully working snippet of code to download a web page:

 KIO::TransferJob *job = KIO::get("http://www.kde.org/news_dyn.html");
 connect(job,  SIGNAL(result(KIO::Job *)),
         this, SLOT(slotResult(KIO::Job *)));
 connect(job,  SIGNAL(data(KIO::Job *, const QByteArray&)),
         this, SLOT(slotData(KIO::Job *, const QByteArray&)));

That's it! The ioslave will download the KDE news page asynchronously. With each chunk of the page it downloads, it will pass it along to your application's slotData() function. When it finishes (for whatever reason), slotResult() will be called.

1.1. Copyright

Copyright (c) 2000 Kurt Granroth, All rights reserved. This is free documentware; you can redistribute it and/or modify it in any way you like as long as you leave this copyright intact.