Objects of the role.Manager class

The instances of Manager class have the following methods:

sendAndReceive(reqMsg[, dstAddr, [(cbFun, cbCtx)]])

Attempt to send request message reqMsg (string) to remote server by either dstAddr address (given in socket module notation), if specified, or default destination whenever given on Manager class instaniation, and receive a response.

Once a response is received, the cbFun is invoked. This callback function must support the following interface:

cbFun(rspMsg, srcAddr, cbCtx)

Where rspMsg is an octet-stream (string), as received from network, and srcAddr is message source address (given in socket module notation).

The callback function must return true if response has been processed successfully or false otherwise. In the latter case, the sendAndReceive() function will keep on re-sending initial request for Manager.retries of times.

If response is not received within Manager.timeout * Manager.retries seconds, the error.NoResponseError exception will be thrown.

open()

Create optionally connected socket object to be used for communication with remote server process.

Return socket object.

send(reqMsg, [dstAddr])

Attempt to send request data reqMsg (string) to remote server by either dstAddr address (given in socket module notation), if specified, or default destination whenever given on Manager class instaniation.

receive()

Wait for server response for Manager.timeout seconds and raise an error.NoResponseError exception if no response arrived in time.

Return a tuple of (rspMsg, srcAddr) where rspMsg is server response (string) and srcAddr is server's address (in socket module notation).

close()

Terminate communication with server and release all associated resources.

Objects of the Manager class have the following public instance variables:

timeout

Specify for how many seconds to wait for response from remote server. The timeout attribute is of floating point type.

The default is 1.0 second.

retries

Specify the number of reqMsg re-transmissions. The retries attribute is of integer type.

The default is 3 retries.


ilya@glas.net