mfc >> Looking for WinSNMP sample code

by Hank T. » Wed, 13 Aug 2003 06:28:04 GMT

I'm looking for sample code for WinSNMP. Can someone
please tell me where to get them? Thanks,



Similar Threads

1. Looking for some sample codes in C# - CSharp/C#

2. looking for code sample for non-blocking TCP sockets

Hi,

I need a code sample for doing this:

-  support for multiple agents that know each other and can talk each other
   over a non-blocking TCP socket.
   each agent can send and recieve data to/from each other.
-  handling agent down events (i don't know how to do it in an elegant way 
when using the socket select method).

I prefer to use the Socket.Select method.
All the socket operations must be in a non-blocking mode.

Thanks.

3. Looking for sample code to send email with exchange

4. looking for custom control sample code

5. Looking for sample code

6. Creating a Database using the STL: Newbie looking for code samples

7. Delphi 7, Excel - have problem - looking for sample code - Delphi VCL Component

8. WinSNMP: Platform SDK sample (wsnmputil) memory leak problem

Hi, I have a problem with WinSNMP - memory leaks, so I take wsnmp sample
from Platform SDK.
Loop was added to SNMP send in this sample (WSnmpUtil.Cpp file):

lines 197-214 in original file (in SET comand):

                if ( result != FALSE )
                {
                    gVars.operation = SET;

                    // copy the object type. Ex: INT UINT32 etc..
                    lvalue.syntax = gVars.value.syntax;

                    ConvertStringToSmiValue( &lvalue );

                    result = CreatePduSendRequest( pSession, &lvalue );

                    // check the error status on pSession.
                    if( pSession->nErrorStatus != 0 )
                        PrintDbgMessage( "Failed in setting the OID value
..\n" );
                    else
                        PrintDbgMessage( "Succeeded in setting the OID value
..\n" );

                }

after loop addition:

                if ( result != FALSE )
                {
                for (int i = 0; i < 10000; i++)//NEW LINE
                {//NEW LINE
                    gVars.operation = SET;

                    // copy the object type. Ex: INT UINT32 etc..
                    lvalue.syntax = gVars.value.syntax;

                    gVars.nRequestId++;//NEW LINE

                    ConvertStringToSmiValue( &lvalue );
                    DWORD dwT1 = GetTickCount();

                    result = CreatePduSendRequest( pSession, &lvalue );
                    DWORD dwT2 = GetTickCount();

                    // check the error status on pSession.
                    if( pSession->nErrorStatus != 0 )
                        PrintDbgMessage( "Failed in setting the OID value
..\n" );
                    else
                        PrintDbgMessage( "Succeeded in setting the OID value
..\n" );
                }//NEW LINE

                }
so I am trying to send 10000 set commands and not 1 as in original file.
command line is:

-v2 set 10.0.0.42 public 1.3.6.1.4.1.12.2.5.0
22222222233333333333444444444444444555555555555666666666666666

10.0.0.42 - does't exist, as a result i receive timeout notification after
each send

as a result I  have continuous memory growth a

Any help will be very appreciated.

Alex