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

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

Private 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

QServerSocket

### Methods

SingleApplicationServer | Constructor
handleClosed | Private method to handle the closure of the socket.
handleCommand | Public slot to handle the command sent by the client.
handleLine | Private method to handle data from the client.
newConnection | Reimplemented to handle a new connection.
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.handleClosed

handleClosed()

Private method to handle the closure of the socket.

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

handleLine()

Private method to handle data from the client.

### SingleApplicationServer.newConnection

newConnection(sockfd)

Reimplemented to handle a new connection.

sockfd
  the socket descriptor

### SingleApplicationServer.shutdown

shutdown()

Public method used to shut down the server.

Up