The instances of role.agent class have the following methods:
Wait for request from a client process or timeout (and raise NoRequest exception) if no request arrived within agent.timeout seconds. On data arrival, pass data item to the callback function, to build a response, and send the response back to client process.
The callback function is invoked in the following fashion: callback(req, src) where req is the data item as sent by client (string) and src is the endpoint of client connection (given in socket module notation).
The callback function must return a tuple of (rsp, dst), where rsp (string) is the data item to be replied back to client by address dst (given in socket module notation) or by originating address if dst is None.
Create socket object and bind it to local interface(s) to be used for communication with remote client processes.
Return socket object.
Attempt to send response data rsp (string) to remote client by either dst address (given in socket module notation).
Wait for and receive request data from a client process or timeout (and raise NoRequest exception) if no request arrived within agent.timeout seconds.
Return a tuple of (req, src) where req (string) is a request data as sent by client and src is the address of client endpoint (given in socket module notation).
Terminate server and release all associated resources.
Objects of the role.agent class have the following public instance variables:
Specify for how many seconds to wait for request to arrive from a client. The timeout attribute is of floating point type.
The default is None what means to wait forever.