Hi
I have an application which will be running Get requests on dozens of SNMP devices. Some will be inaccessible at times, and I'd expect different network delays to different devices.
If I use the synchronous GetResponse method, this blocks until timeout if a device is inaccessible. If I have 50 devices and a 2s timeout, and want to poll all 50 devices every 5 seconds, if three are inaccessible I wouldn't get round all 50 within the 5s cycle.
I was therefore looking at SnmpMessageExtension.BeginGetResponse, but although this is asynchronous, it still calls BeginReceive on the socket each time and also EndGetResponse throws an exception if the request id doesn't match the response id - so it's still coupling requests and responses.
What I want to be able to do is to fire off 50 Get requests at once, then process the responses as they come in - and I'd do the matching between requests and responses. Inaccessible devices wouldn't return a response, which I'd then handle.
I can't see that this is possible. The SendAsync method throws an exception if anything except a trap is sent. Am I missing something that makes it not possible to work like this?
Thanks
Giles.
Comments: I worked it out - my confusion stemmed from a misunderstanding. I had mistakenly thought all SNMP requests are sent from port 161. But no: each call to GetResponse is executed on a different ephemeral port so even though one call may wait a few seconds for a timeout, other calls to GetResponse can happen concurrently. The SNMP devices reply to my SNMP-GET back to the ephemeral port, not back to port 161. Providing each device is polled on a separate thread (I use a System.Timers.Timer to dispatch polls), it works perfectly. Please close this as a 'non issue'. Thanks Giles.
I have an application which will be running Get requests on dozens of SNMP devices. Some will be inaccessible at times, and I'd expect different network delays to different devices.
If I use the synchronous GetResponse method, this blocks until timeout if a device is inaccessible. If I have 50 devices and a 2s timeout, and want to poll all 50 devices every 5 seconds, if three are inaccessible I wouldn't get round all 50 within the 5s cycle.
I was therefore looking at SnmpMessageExtension.BeginGetResponse, but although this is asynchronous, it still calls BeginReceive on the socket each time and also EndGetResponse throws an exception if the request id doesn't match the response id - so it's still coupling requests and responses.
What I want to be able to do is to fire off 50 Get requests at once, then process the responses as they come in - and I'd do the matching between requests and responses. Inaccessible devices wouldn't return a response, which I'd then handle.
I can't see that this is possible. The SendAsync method throws an exception if anything except a trap is sent. Am I missing something that makes it not possible to work like this?
Thanks
Giles.
Comments: I worked it out - my confusion stemmed from a misunderstanding. I had mistakenly thought all SNMP requests are sent from port 161. But no: each call to GetResponse is executed on a different ephemeral port so even though one call may wait a few seconds for a timeout, other calls to GetResponse can happen concurrently. The SNMP devices reply to my SNMP-GET back to the ephemeral port, not back to port 161. Providing each device is polled on a separate thread (I use a System.Timers.Timer to dispatch polls), it works perfectly. Please close this as a 'non issue'. Thanks Giles.