c++builder - Indy's SNMP Trap send nothing -


i tried send snmp trap using indy's component tidsnmp. (code copied implementing snmp sendtrap using indy components)

void __fastcall tmainform::btsendtrapclick(tobject *sender) {  string myenterprise   = _d("1.5.5.5.5.5.5.5");  string eventtype      = myenterprise + _d(".1");  string eventdistance  = myenterprise + _d(".2");   tidsnmp * idsnmp = 0;   idsnmp = new tidsnmp(null);   idsnmp->trap->host       = edhost->text;  idsnmp->trap->community  = _d("public");  idsnmp->trap->enterprise = myenterprise;  idsnmp->trap->gentrap    = 6;              // i've met such values  idsnmp->trap->spectrap   = 1;              // somewhere in inet  idsnmp->trap->mibadd(eventtype,_d("ftcritical"));  idsnmp->trap->mibadd(eventdistance,_d("2.357"));   idsnmp->sendtrap();   delete idsnmp; } 

but wireshark doesn't registar network activity. tried variant quicksendtrap same result. in despair decided try indy's udp component sending something.

void __fastcall tform1::btfireclick(tobject *sender) {  tidudpclient* udpclient = 0;  tidbytes senddata;   myclass* packet = new myclass();  packet->a = 10;  packet->b = 77;  packet->c = "test";   int size = sizeof(*packet);  senddata = rawtobytes(packet, size);   udpclient = new tidudpclient(null);  udpclient->host = "192.168.100.19";  udpclient->port = 162;  udpclient->sendbuffer(senddata);   delete udpclient; } 

surely it's not real snmp trap wireshark see this:

192.168.100.21  192.168.100.19  udp 54  source port: 49873  destination port: snmptrap 

wireshark filter "udp portrange 161-162"

and in data section can find values. way snmp component works getting values simple idsnmp->sendquery() , registered wireshark well.

so, there additinal conditionals in order sendtrap() works properly?

i have windows7, administative rights. firewall turned off. code compiled embarcadero rad studio 2010, desktop application.

should snmp trap receiver wait sendtrap() in order sendtrap() work? (unfortunately, haven't got computer experiments @ moment) should oid "1.5.5.5.5.5.5.5" registered somewhere in computer in order sendtrap() work?

maybe other requirements?

but wireshark doesn't registar network activity

that not said in other discussion. said working.

so, there additinal conditionals in order sendtrap() works properly?

no. code gave need.

should snmp trap receiver wait sendtrap() in order sendtrap() work?

no. udp connection-less. receiver not required in order send. if there no receiver, icmp error sent sender.

should oid "1.5.5.5.5.5.5.5" registered somewhere in computer in order sendtrap() work?

no.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -