Google

LINK="#0000bb" VLINK="#551a8b" ALINK="#ff0000">

Objects of the role.agent class

The instances of role.agent class have the following methods:

receive_and_send([(cb_fun, cb_ctx)])

Wait for request from a client process or timeout (and raise error.IdleTimeoutError exception) if no request arrived within the agent.timeout seconds. On data arrival, pass data item to the cb_fun function, to build a response, and send the response back to client process.

The optional cb_fun and cb_ctx parameters may be used to specify alternative user callback function to be invoked on question arrival. These parameters, whenever given here, override the default settings given on agent class instaniation.

open()

Create socket object and bind it to local interface(s) to be used for communication with remote client processes.

Return socket object.

send(answer, dst)

Attempt to send response data answer (string) to remote client by dst address (given in socket module notation).

receive()

Wait for and receive request data from a SNMP manager process or timeout (and raise error.IdleTimeoutError exception) if no request arrived within agent.timeout seconds.

Return a tuple of (question, src) where question (string) is a request data as sent by SNMP manager and src is the address of manager endpoint (given in socket module notation).

close()

Terminate server and release all associated resources.

Objects of the role.agent class have the following public instance variables:

timeout

Specify for how many seconds to wait for request to arrive from SNMP manager. The timeout attribute is of floating point type.

The default is None what means to wait forever.


ilya@glas.net