keep us posted.
My experience has been quite the opposite.
In multi threaded informs, I had to move init_snmp to the beginning of the
process that spawns threads and I had to set several properties that are
threads wide and if such properties were applied within the context of a
thread then it creates havoc in other threads.  The single session apis
have the equivalent _session_ or _sess_ ones.
Can you please point a link to the restriction on No Threads for our
benefit if you don't mind.
What seg fault(s)?  Maybe that will help some one in the group to help.

Thanks
Mukund


On Sun, Sep 9, 2012 at 12:33 PM, Katia S. <kat...@iit.demokritos.gr> wrote:

> Well, conducting a fairly difficult research in the field of the multiple
> thread Net-SNMP applications, I found out that you cannot use threads
> whith the same "init_snmp(argv[0])" statement. The post I read did not
> give any other information, just this: you can have multiple sessions with
> the same init_snmp(), but ONLY if you are NOT using threads.. No other
> explanation was given. That's why I'm so stuck. I have no idea how to
> implement a multi-threaded net-snmp client with one session per thread,
> with no SegFaults..
>
> If anyone has a tutorial, a how-to or a code snippet regarding the
> aforementioned problem, please please PLEASE share!
>
>
> > Hi Katia S:
> > I have been using multiple threads where each thread starts a client and
> > maintains a single session. I am  using this for Informs as opposed to
> the
> > get/set.
> > In all the usage documentation it was found that we need to perform
> > init_snmp("PROGNAME"),  once for all threads.  Each thread creates a
> > session using the single session APIs.  I would also like to know if the
> > init_snmp needs to be done per session as stated by you below.   If
> > init_snmp is done once per process and  snmp_sess_open is used to create
> a
> > valid snmp session within each thread context then multiple threads
> > maintaining one session per thread works as expected.
> > Thanks
> > Mukund
> >
> >
> >
> > On Fri, Sep 7, 2012 at 5:15 AM, Katia Sarsempagieva <
> > kat...@iit.demokritos.gr> wrote:
> >
> >> **
> >> Greetings everyone!
> >> I have already and extensively searched answers for the particular
> >> problem,
> >> but I failed to find any. So, if this topic has already been answered, I
> >> apologize.
> >>
> >> Problem Context:
> >> ---------------------------------
> >> Let's say I have a MIB that contains a table.
> >> And I have written a multi-threaded Net-SNMP Client application that
> >> reads
> >> and writes
> >> to the mentioned MIB.
> >> Each thread writes on its own Index. For example, only one thread will
> >> write and read the
> >> row with Index = 1 (myTable.1), so I do not have to lock any rows or
> >> tables to add thread protection.
> >> (The second thread will work on Index = 2 (myTable.2), and so on and so
> >> forth).
> >>
> >> Each thread creates its own SNMP Session. It initializes a session with
> >> the name "ThreadID=Index",
> >> where "Index" is the Index of the row the particular thread will play
> >> with.
> >> (Example: init_snmp("ThreadIndex=1"); )
> >> Later, it creates a Session and opens it.
> >> With the open Session, it uses get and set code to play with the MIB and
> >> at the end it closes the Session.
> >>
> >>
> >> Problem Question:
> >> ---------------------------------
> >> Are the mentioned assumptions even correct?
> >> Is it possible to have a multi-threaded Net-SNMP Client with one session
> >> per thread?
> >> If yes, what are the rules that have to be followed in order to avoid
> >> SegFaults, that are occurring at my program
> >> at random times (usually when the client changes to another thread or
> >> when
> >> a thread gets a "NULL" response via
> >> a snmp_synch_response function)?
> >>
> >> Environment:
> >> ---------------------------------
> >> Just in case, I post the environment parameters in which I am working.
> >>
> >> OS: Debian, Linux
> >> Net-SNMP Version: 5.7.1 (source code installation)
> >> Threading Lib: pthread.h
> >> Net-SNMP Client and Server, both on Localhost
> >> Programming Language: C
> >>
> >> Any insight on the aforementioned problem and any useful advice will be
> >> greatly appreciated!
> >> Thank you very much in advance!
> >>
> >> Best regards,
> >>
> >> --
> >> *Katia Sarsempagieva*
> >>
> >> * Research Assistant
> >> Media Network Laboratory
> >> Institute of Information and Telecommunications
> >> NCSR Demokritos
> >> *
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Live Security Virtual Conference
> >> Exclusive live event will cover all the ways today's security and
> >> threat landscape has changed and how IT managers can respond.
> >> Discussions
> >> will include endpoint security, mobile security and the latest in
> >> malware
> >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >> _______________________________________________
> >> Net-snmp-coders mailing list
> >> Net-snmp-coders@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
> >>
> >>
> >
>
>
> --
> (Under Investigation) Research Associate
> Media Networks Laboratory
> Institute of Networks and Telecommunications
> NCSR Demokritos
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to