# eric4.Utilities.SingleApplication

Module implementing the single application server and client.

### Classes

SingleApplicationClient | Class implementing the single application client base class.
SingleApplicationServer | Class implementing the single application server base class.

### Functions

None

## SingleApplicationClient

Class implementing the single application client base class.

### Derived from

object

### Methods

SingleApplicationClient | Constructor
connect | Public method to connect the single application client to its server.
disconnect | Public method to disconnect from the Single Appliocation server.
errstr | Public method to return a meaningful error string for the last error.
processArgs | Public method to process the command line args passed to the UI.
sendCommand | Public method to send the command to the application server.

#### SingleApplicationClient (Constructor)

SingleApplicationClient(pidFile)

Constructor

pidFile
  filename of the PID file used to get some interface informations

#### SingleApplicationClient.connect

connect()

Public method to connect the single application client to its server.

Returns:
  value indicating success or an error number. Value is one of:

  0 | No application is running
  1 | Application is already running
  -1 | The lock file could not be read
  -2 | The lock file is corrupt

#### SingleApplicationClient.disconnect

disconnect()

Public method to disconnect from the Single Appliocation server.

#### SingleApplicationClient.errstr

errstr()

Public method to return a meaningful error string for the last error.

Returns:
  error string for the last error (string)

#### SingleApplicationClient.processArgs

processArgs(args)

Public method to process the command line args passed to the UI.

Note: This method must be overridden by subclasses.

args
  command line args (list of strings)

#### SingleApplicationClient.sendCommand

sendCommand(cmd)

Public method to send the command to the application server.

cmd
  command to be sent (string)

Up

## SingleApplicationServer

Class implementing the single application server base class.

### Derived from

QTcpServer

### Methods

SingleApplicationServer | Constructor
__disconnected | Private method to handle the closure of the socket.
__newConnection | Private slot to handle a new connection.
__parseLine | Private method to handle data from the client.
handleCommand | Public slot to handle the command sent by the client.
shutdown | Public method used to shut down the server.

#### SingleApplicationServer (Constructor)

SingleApplicationServer(pidFile)

Constructor

pidFile
  filename of the PID file used to record some interface informations

#### SingleApplicationServer.__disconnected

__disconnected()

Private method to handle the closure of the socket.

#### SingleApplicationServer.__newConnection

__newConnection()

Private slot to handle a new connection.

#### SingleApplicationServer.__parseLine

__parseLine()

Private method to handle data from the client.

#### SingleApplicationServer.handleCommand

handleCommand(cmd, params)

Public slot to handle the command sent by the client.

Note: This method must be overridden by subclasses.

cmd
  commandstring (string)
params
  parameterstring (string)

#### SingleApplicationServer.shutdown

shutdown()

Public method used to shut down the server.

Up