Dart.Snmp Namespace > Agent Class > Start Method : Start(RequestReceived,IPEndPoint,Boolean,Object) Method |
Public Overloads Sub Start( _ ByVal callback As RequestReceived, _ ByVal localEP As IPEndPoint, _ ByVal acceptBroadcast As Boolean, _ ByVal state As Object _ )
Dim instance As Agent Dim callback As RequestReceived Dim localEP As IPEndPoint Dim acceptBroadcast As Boolean Dim state As Object instance.Start(callback, localEP, acceptBroadcast, state)
public void Start( RequestReceived callback, IPEndPoint localEP, bool acceptBroadcast, object state )
public: void Start( RequestReceived* callback, IPEndPoint* localEP, bool acceptBroadcast, Object* state )
public: void Start( RequestReceived^ callback, IPEndPoint^ localEP, bool acceptBroadcast, Object^ state )
Use this method to receive SNMP requests from SNMP managers. It is possible for the RequestReceived delegate to be raised concurrently on multiple IO Completion threads, so its code should be thread-safe.
This method always creates a new SocketBase.Socket. Use multiple Agent instances to accept SNMP requests on multiple sockets.
Unhandled exceptions thrown on the IO Completion thread are caught and reported by the Error event.
Scripting applications should use Receive instead.
private void button1_Click(object sender, EventArgs e) { //Add a variable to the agent agent1.Variables.Add(agent1.Mib.GetByNodeName(NodeName.sysContact).GetIid(), agent1.Mib.CreateVariable(NodeName.sysContact, "Systems Admin")); //Start listening for requests agent1.Start(agent1_MessageReceived, null); } private void agent1_MessageReceived(Agent agent, RequestMessage request, object state) { //Create and send a response whenever a request is received agent1.Send(agent1.CreateResponse(request), request.Origin); }
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) 'Add a variable to the agent agent1.Variables.Add(agent1.Mib.GetByNodeName(NodeName.sysContact).GetIid(), agent1.Mib.CreateVariable(NodeName.sysContact, "Systems Admin")) 'Start listening for requests agent1.Start(AddressOf agent1_MessageReceived, Nothing) End Sub Private Sub agent1_MessageReceived(ByVal agent As Agent, ByVal request As RequestMessage, ByVal state As Object) 'Create and send a response whenever a request is received agent1.Send(agent1.CreateResponse(request), request.Origin) End Sub