# eric6.Toolbox.SingleApplication

Module implementing the single application server and client.

### Global Attributes

None

### 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

### Class Attributes

None

### Class Methods

None

### 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.

### Static Methods

None

#### SingleApplicationClient (Constructor)

SingleApplicationClient(name)

Constructor

name
  name of the local server to connect to (string)

#### 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

#### 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)

Raises RuntimeError:
  raised to indicate that this method must be implemented by a subclass

#### 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

QLocalServer

### Class Attributes

None

### Class Methods

None

### 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.

### Static Methods

None

#### SingleApplicationServer (Constructor)

SingleApplicationServer(name)

Constructor

name
  name this server is listening to (string)

#### 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)

Raises RuntimeError:
  raised to indicate that this method must be implemented by a subclass

#### SingleApplicationServer.shutdown

shutdown()

Public method used to shut down the server.

Up