PySNMP: Transport Mappings: UDP/IP: Synchronous: Agent: Objects

### Objects of the role.Agent class

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

receiveAndSend([(cbFun, cbCtx)])

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

  The optional cbFun and cbCtx parameters may be used to specify alternative user callback function to be invoked on reqMsg 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(rspMsg, dstAddr)

  Attempt to send response data rspMsg (string) to remote client by dstAddr 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 (reqMsg, srcAddr) where reqMsg (string) is a request data as sent by SNMP manager and srcAddr 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.