# class Connection

###

Module | kio
Namespace | KIO
Class | Connection
Inherits | QObject

This class provides a simple means for IPC between two applications via a pipe. It handles a queue of commands to be sent which makes it possible to queue data before an actual connection has been established.

### methods

- Connection (parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QObject | 0

  Creates a new connection.

  See also connectToRemote, listenForRemote

- Connection (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QObject | 0

- close ( )

  returns Nothing

  Closes the connection.

- connectToRemote (address)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  address | QString |

  Connects to the remote address.

- errorString ( )

  returns QString

- hasTaskAvailable ( )

  returns bool

  Returns true if there are packets to be read immediately, false if waitForIncomingTask must be called before more data is available.

- inited ( )

  returns bool

  Checks whether the connection has been initialized. Returns true if the initialized

  See also init()

- isConnected ( )

  returns bool

- read (_cmd, data)

  returns int
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  _cmd | int |
  data | QByteArray |

  Receive data.

  _cmd - the received command will be written here

  data - the received data will be written here

  Returns >=0 indicates the received data size upon success -1 indicates error

- readyRead ( )

  returns Nothing
  SIGNAL ("readyRead ()")

- resume ( )

  returns Nothing

  Resume handling of incoming data.

- send (cmd, arr)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  cmd | int |
  arr | QByteArray | QByteArray()

  Sends/queues the given command to be sent.

  cmd - the command to set

  arr - the bytes to send Returns true if successful, false otherwise

- sendnow (_cmd, data)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  _cmd | int |
  data | QByteArray |

  Sends the given command immediately.

  _cmd - the command to set

  data - the bytes to send Returns true if successful, false otherwise

- suspend ( )

  returns Nothing

  Don't handle incoming data until resumed.

- suspended ( )

  returns bool

  Returns status of connection. Returns true if suspended, false otherwise

- waitForIncomingTask (ms)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  ms | int | 30000

  Waits for one more command to be handled and ready.

  ms - the time to wait in milliseconds Returns true if one command can be read, false if we timed out