SNMP request time out?

Source: Internet
Author: User
Tags snmp snmp object

why is it possible? Here, I am going to learn more about SNMP. The Program is running normally. If SNMP get is called successfully, my time-out is reached. Code is as follows.

# Include "snmp_pp.h" # include "iostream. H "# define sysdescr" 1.3.6.1.2.1.1.1.0 "// Object ID for system descriptorvoid main () {SNMP: socket_startup (); // socket_startup () static member function, initialize the function int status of winsocket; // return status ctarget (IPaddress) "192.168.1.74 "); // SNMP ++ V1 target // use an address object to construct a ctarget object VB (sysdescr); // SNMP ++ variable binding PDU; // SNMP ++ PDU // ------- [constru CT a SNMP ++ SNMP object] ----------------------------------------- SNMP (Status); // create a SNMP ++ session to create a new SNMP object. // The first parameter indicates the creation status, 0 indicates that if (status! = Snmp_class_success) {// check creation status cout <SNMP. error_msg (Status); // If fail, print error string return ;} // ------- [invoke a SNMP ++ get] ------------------------------------------------------- // invoke means requests help or protection (from a deity) PDU + = Vb; // Add the variable binding if (status = SNMP. get (PDU, ctarget ))! = Snmp_class_success) cout <"failed to get \ n" <SNMP. error_msg (Status); else {PDU. get_vb (VB, 0); // extract the variable binding cout <"system descriptor =" <VB. get_printable_value () ;}// print out SNMP: socket_cleanup (); // socket_cleanup () static member function to release the winsocket resources initialized by the above function}

Find out the cause of SNMP request time out through this website. It turns out to be the cause of community. Just change it to the communiry corresponding to the switch. If it is get, it should be get community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.