get client ip address

2011-02-16 Thread th exterit
Hi there. First off, apologies for mailing here but I was having little luck from the users mailing list. I am writing a trap listener which listens on upd 162. When each trap comes in I want to grab the source IP address of the device which sent the trap. My code basically takes snmptrapd.c and

Re: get client ip address

2011-02-16 Thread th exterit
Brilliant thanks, works like a treat! On Wed, Feb 16, 2011 at 3:17 PM, Niels Baggesen wrote: > On Wed, Feb 16, 2011 at 02:00:03PM +0000, th exterit wrote: > > I am writing a trap listener which listens on upd 162. When each trap > comes > > in I want to grab the source IP add

Thread safety

2011-04-01 Thread th exterit
Hi there, sorry to bother you. Currently trying to write a multithreaded application using net-snmp. Each thread basically takes queries from a queue and executes them. However, I found myself having to put a mutex around snmp_synch_response() as it mustn't like simultaneous access. Now, I've o

Re: Thread safety

2011-04-01 Thread th exterit
Many thanks Dave, will give it a go. On Fri, Apr 1, 2011 at 8:41 PM, Dave Shield wrote: > On 1 April 2011 16:47, th exterit wrote: > > Now, I've only just read that Net-SNMP isn't strictly thread safe. > > Is there any way around this at all? > > Use the &qu

Re: Thread safety

2011-04-01 Thread th exterit
uot;status = snmp_sess_synch_response(sp, req, & resp);" line it just doesn't like. Thanks, T On Fri, Apr 1, 2011 at 8:41 PM, Dave Shield wrote: > On 1 April 2011 16:47, th exterit wrote: > > Now, I've only just read that Net-SNMP isn't strictly thread safe

Re: Thread safety

2011-04-02 Thread th exterit
Working now, the problem was you need to pass the void pointer to snmp_sess_synch_response(), not the session pointer. T On Fri, Apr 1, 2011 at 10:35 PM, th exterit wrote: > I followed README.threads but it still kept tripping up on the > corresponding snmp_sess_synch_response() fu

Multithreading and async callback - segault

2011-05-14 Thread th exterit
Hi there. I have two threads. The main thread sends snmp requests, the other receives responses. And I can only use snmp_sess_*() calls since it is multithreaded. I want to be able to send requests and forget about them until a response is detected on the socket. I want to do this so that I do

Re: Multithreading and async callback - segault

2011-05-16 Thread th exterit
The problem is calling snmp_sess_close() inside the callback function. You have to wait for snmp_sess_read() to finish before calling snmp_sess_close(). Problem solved. On Sat, May 14, 2011 at 10:58 AM, th exterit wrote: > Hi there. > > I have two threads. The main thread sends snmp