snmpStartListen (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All NX devices

Firmware version:

1.50.00


This function will start a listening operation for incoming traps on the specified port number.

 

To receive traps using SNMPv3, the security must be configured first.

When using the USM method, the list of users must be configured on all connecting devices (Using the snmpUserSet and snmpUserGet functions).

When using the TSM method, the list of certificates must be configured on all connecting devices (Using the snmpCertSet and snmpCertGet functions).

If a managed device cannot be identified by one of these lists, then traps will not be received.

 

Input:

Port : DINT [1..65535] (default 162)

The port to listen on.

 

TCP : BOOL  (default FALSE)

Set to TRUE if a TCP connection is required, otherwise an UDP connection is used.

The protocol uses UDP connections as default.

 

Version : SINT (default _SNMP_VER_2C)

The SNMP version to use. (obsoleted from firmware version 1.52.00, as all versions are accepted)

_SNMP_VER_1

SNMP version 1. Using community names for security.

_SNMP_VER_2C

SNMP version 2. Using community names for security.

_SNMP_VER_3

SNMP version 3. Advanced security, including certificates.

 

Community : STRING

The community string. Used in Version 1 and 2c.

 

Security : SINT (default _SNMP_SEC_USM)

The type of security to use. Used in version 3.

_SNMP_SEC_USM

- The USM security model. (username and password)

_SNMP_SEC_TLS

- The TSM security model. (certificates)

 

Output:

Handle : SYSHANDLE

The handle to the connection.

 

Returns: INT

1

- Success.

0

- This function is not supported.

-2

- Invalid parameter.

-3

- Too many server sessions. See limitations on overview page.

-6

- The port is in use.

-8

- Failed to open port.

-12

- General error.

-17

- Publishing service is running. See limitations on overview page.

 

Declaration

FUNCTION snmpStartListen : INT;
VAR_INPUT
  Port      : DINT := 162;
  TCP       : BOOL := FALSE;
  Version   : SINT := _SNMP_VER_2C;
  Community : STRING;
  Security  : SINT := _SNMP_SEC_USM;
  Handle    : ACCESS SYSHANDLE;
END_VAR;

 

Example:

Please see the example at Examples - SNMP Mananger