Hi,
Thanks for quickly clearing up the doubt on TEST.
>I have a bad feeling that it isn't the "send" operation that blocks for you
>but rather something else so, please, provide some more data, like e.g. a
>strace of your application when running.
I'll put some more details on the snmp_async_send.
First of all, I'm not much familiar with strace.
So I'll put it like this.
Forget my application and consider a standalone netsnmp app.
Say, i am issuing an SNMPGET for "sysDescr.0" on a CISCO switch using SNMPv3.
And using this code.
...
filling all session variables
session_handle = snmp_open(&my_session);
my_pdu = snmp_pdu_create(SNMP_MSG_GET);
...
printf("Before send\n");
int status = snmp_async_send(session_handle, my_pdu, callback_response, NULL);
if ( !status )
{
printf("send failed\n");
if(session_handle->s_snmp_errno == -24)
printf("SNMPERR_TIMEOUT\n");
}
printf("After send\n");
...
Case 1 The CISCO switch is powered on
==============================
Here the second line is printed with a little delay after the first one.
Before send
After send
Case 2 The CISCO switch is powered off
==============================
Here "Before Send" is printed and the application waits for some descent 2 sec
to print
send failed
SNMPERR_TIMEOUT
After Send
I don’t want that delay in printing.
So what I am asking is ; whether a variant of snmp_async_send is available,
which will never wait for that time to print an error.
Or in other words, can I skip the part where the snmp_async_send will wait to
timeout; and make it directly return.
I would like to handle those errors in the call-back function, if possible.
Thanks and regards,
Basil Joseph
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Hi,
>
> Thanks for answering my previous questions. Now please help me solve a
> problem I am facing.
>
> I have created an application that will query a network device every
> 10 sec.
>
> And my app will also sent some critical info to a network server in
> every 200 milliseconds.
>
> A loop-timer mechanism will take care of this, if no functions are
> blocking calls.
>
> So I have used “snmp_async_send” API to query the device, so that it
> will not block my application flow.
>
> And everything worked fine, for some time.
>
> But recently I have found that when the n/w device to be queried, is
> powered off; this API will block my application flow for some 2 sec,
> and returns a timeout error.
How do you refer to the device. What system call is it that blocks? Is it the
send that will transmit data to your device or is it something else?
I have a bad feeling that it isn't the "send" operation that blocks for you but
rather something else so, please, provide some more data, like e.g. a strace of
your application when running.
> But by this time the window for sending the critical info to the
> server will be over.
>
> So my app fails..
>
> The waiting for timeout may be causing this problem.
>
> Is there any way to make this function (snmp_async_send) truly
> asynchronous?
>
> That means, is it possible to make this function to just send the PDU
> and return, and to capture the error in the response callback?
>
> I think somebody has also asked this question, but it remains
> unanswered.
>
>
>
> And I would like to know whether there is a command known as TEST,
> which is to be used before SNMPSET.
>
> Somebody told me, it is better to issue a TEST before a SET.
>
> If true, can you point me to any tutorials/references for that.
Internally an snmp agent should handle all set requests as atomic operations.
This is often accomplished using a two-phase commit protocol and then TESTSET
is used to ask the object that is to be updated if it can accept a given new
value.
The end of this is that you, as a management station, doesn't have to care
about it.
/MF
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders