Namespace KSocketFactory


Module kdecore
Namespace KSocketFactory

KSocketFactory provides functions for opening sockets to remote hosts

KSocketFactory is a socket-opener group of functions that must be used whenever a KDE application wants to communicate with a remote host. It will determine the necessary proxy and local KDE settings, then open the connection. The typical use-case is:

d->socket = KSocketFactory.connectToHost("www.kde.org", "http"); d->socket->setParent(this); QObject.connect(d->socket, SIGNAL(connected()), this, SLOT(socketConnected()));

Synchronous operation is not recommended, since it may lead to UI deadlocks. It is preferred to return to the mainloop if the socket is being created in the main GUI thread.

However, if the socket is created in an auxiliary thread, it is possible to use something equivalent to synchronous mode:

d->socket = KSocketFactory.synchronousConnectToHost("www.kde.org", "http"); d->socket->setParent(this);

All objects returned from these functions belong to the caller and must be disposed of properly. Calling QObject.setParent() or passing a parent object is the recommended way.

Author Thiago Macieira



methods