This is a multi-part message in MIME format.
--------------040308000208020501030801
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I am working on an application that needs to run on both Windows and
Linux platforms, and in order to do that I use mono (i.e. .Net).

For the snmp-functionality of that application I use net-snmp, since it
comes in both flavors as well. But I run into the following issue, when
using asynch operations:

I must call snmp_select_info and then call select on the returned
fd_set, but this is a strictly posix approach, ergo I cannot call select
from the .net environment.
I wonder why this approach was chosen? It makes more sense to me to
handle the select in net-snmp, since an application doing asynch
operations is not interested in the specific fd's involved, it wants to
be woken up when data has arrived as is done in the snmp_read call.

So I implemented this, and it seems to work fine. I am just wondering if
I am missing some details why this approach is false, and if my
implementation is not violating your architecture, how do we proceed
from here.

Finally my changes:
in snmp_api.c I introduced a new function snmp_asynch_read (of course
this should be implemented differently, for one it should check wether a
callback is provided for this session, and snmp_select_info could be
skipped by getting the data directly from the session):

/*
* Loop over this function untill all data has been
* recieved (-1 is returned).
*
* returns 0 if success, -1 if fail
*/
int
snmp_asynch_read()
{
int rc = 0; //Success
int numfds = 0;
int block = 0;

fd_set fdset;
FD_ZERO(&fdset);

struct timeval timeout;

snmp_select_info(&numfds, &fdset, &timeout, &block);
numfds = select(numfds, &fdset, NULL, NULL, block?NULL:&timeout);

if (numfds > 0)
{
snmp_read(&fdset);
} else {
snmp_timeout();
rc = -1; //'fail'
}

return rc;
}

Kind Regards,

Erik van Veelen
Senior (embedded) software engineer
AimValley B.V.

--
This message has been scanned for viruses and is believed to be clean


--------------040308000208020501030801
Content-Type: text/x-vcard; charset=utf-8;
name="evveelen.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="evveelen.vcf"

begin:vcard
fn:Erik van Veelen
n:van Veelen;Erik
org:AimSys
adr:;;Anton Philipsweg 1;Hilversum;;1223 KZ;the Netherlands
email;internet:evveelen@aimvalley.nl
title:Software Engineer
tel;work:+31 35 689 1929
tel;fax:+31 35 689 1901
note:Kind regards,
x-mozilla-html:FALSE
url:http://www.aimsys.nl
version:2.1
end:vcard


--------------040308000208020501030801
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--------------040308000208020501030801
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders

--------------040308000208020501030801--