[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::netview-nt

Title:Notes Conference for TME 10 NetView for NT NT
Moderator:TUXEDO::BAKER
Created:Mon Apr 03 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:540
Total number of notes:1903

518.0. "acccess violation in the nvsnmp.dll" by AZUR::BERREZ () Fri Feb 21 1997 12:44

I wrote an application using the Netview snmp API . I used the nvSnmpBlockingGetTable with a callback
according the code sample in the documentation.

All works fine unless a node doesn't respond and the timeout occurs. In this case when returning from the
callback I get an access violation in the nvsnmp.dll

following a piece of my callback code :



#include <iostream.h>
#include "CMSKSnmpClient.hxx"
//#include "MITsnmp.hxx"
#include "MITGlobal.hxx"
#include "MITTools.hxx"
#include "MITdef.hxx"
#include "CEventLog.hxx"
#include "/berrez/mitdev/DCMessage/DLLMessages.h"
//global variables


static float           BandwidthUtilIn, PeakuseIn[50][30];
static float           BandwidthUtilOut, PeakuseOut[50][30]; 
static unsigned long   ifSpeed[50][

/**************************************************************************/
/**************************** callback() **********************************/
//* called automatically by nvsnmpBlockinggetTable
//*
/**************************************************************************/
void pduCallback(int type, OVsnmpSession *session, OVsnmpPdu *table,
              void *userData)

{
   OVsnmpVarBind   *elementPtr = NULL;
   cb_info     *data = (cb_info*) userData;
   int             i, j,numnode;
   CString ErrorMessage;
   DWORD dwPosition;
   TCHAR szCause[255];

   // the table below contains some indexes of data into the ifEntry structure
   // see RFC 1213 for total comprehension
   // 1 = ifDescr
   // 4 = ifSpeed
   // 9 = ifInOctets
   // this table is one of the parameter of nvsnmpGetTableElement

   int             objid[8] = {1,4,9,12,13,15,18,19};
   
    float rateErrIn, rateErrOut, rateDiscIn, rateDiscOut;
	time_t             tloc;
    struct tm *timeofday = NULL;
	char strday[2],strmon[2];
	char stryear[4];
	CFile histoFile;
	CFileException except;

	CString writeBuffer;
	histo_rec *histoBuffer = NULL;

	CTrace CallbackTrace("pduCallback");

	CallbackTrace.Trace("starting");

	if (type == SNMP_ERR_NO_RESPONSE)
	{
	      CallbackTrace.Trace("No Response Returned (within user callback)"); 
		  data->errInCallback = 1;
	      CallbackTrace.Trace("Return to CreateNewreport"); 
              OVsnmpFreePdu(table);
		  return;   ---> after this return the access violation occurs
	}


......  follow the real application
  return --> this doesn't crash when application finishes.
}


Nota : I am running Netview NT 3.1 Intel

       I never had the same behaviour with the same code on UNIX and NT ALPHA, but it is just a remark and not
       a proof.


                   Any idea ?

                              Robert
T.RTitleUserPersonal
Name
DateLines