Soprano.Client.TcpClient

KDE 4.2 PyKDE API Reference

- KDE's Python API

# TcpClient Class Reference

`from PyKDE4.soprano import *`

Inherits: QObject,Soprano::Error::ErrorCache
Namespace: Soprano::Client

## Detailed Description

\class TcpClient tcpclient.h Soprano/Client/TcpClient

Creates a connection to the %Soprano server through a TCP connection.

The %Soprano server supports more than one way of communication. Beside D-Bus (see DBusClient) and local socket communication (LocalSocketClient) it can be contacted via TCP. For that to work the server has to be listening on some port (Server.ServerCore.listen).

Warning:
  The TcpClient does not support signals. Thus, the models created by it will not emit signals such as Model.statementAdded. Also no permission handling or any kind of security is implemented at the moment. Thus, if a server is running and is listening on a port, it is open to connections from any client on any computer in the network.

Author:
  Sebastian Trueg <trueg@kde.org>

## Attributes
int | DEFAULT_PORT
## Methods
| __init__ (self, QObject parent=0)
bool | connect (self, QHostAddress address=QHostAddress.LocalHost, int port=DEFAULT_PORT)
Soprano.Model | createModel (self, QString name, [Soprano.BackendSetting] settings=QList())
| disconnect (self)
bool | isConnected (self)
| removeModel (self, QString name)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent=0
| ) |  |  |

Create a new Client instance.

bool connect | ( | self, |
|  | QHostAddress | address=QHostAddress.LocalHost,
|  | int | port=DEFAULT_PORT
| ) |  |  |

Soprano.Model createModel | ( | self, |
|  | QString | name,
|  | [Soprano.BackendSetting] | settings=QList()
| ) |  |  |

Creates a new Model instance that wraps a server model. %Client models are very light wrappers and creating them is very fast.

Parameters:

  | name | The name of the model to access.

Parameters:

  | settings | The settings to send to the server for creating a new model. These settings may be ignored by the server if a model with that name has already been created.

Returns:
  A new Model instance wrapping the requested server model or 0 on error (check lastError() for details.)

disconnect | ( |  | self ) |

Disconnect from the server. The created model instances are not deleted but remain useless; open iterators are closed.

bool isConnected | ( |  | self ) |

Check if the client is connected to a server.

Returns:
  true if this client is connected to a server, false otherwise.

removeModel | ( | self, |
|  | QString | name
| ) |  |  |

Deletes a model including all its data.

Parameters:

  | name | The name of the model to remove.

Warning:
  Calling this method will remove all data physically. It can not be reverted. Use with care.

Since:
  2.1

## Attribute Documentation

int DEFAULT_PORT

Tries to connect to the %Soprano server.

Returns:
  true on success, false if an error occured. Check lastError() for details.