[SNMP4J] Trap sending from snmp4j agent problem

Vinoj Louis Vinoj.Louis at aricent.com
Wed Nov 21 06:27:25 CET 2007


Hi,

I tried using TestAgent.java to send a trap. It worked well in windows 
machine when I used localhost or 127.0.0.1 in

 targetMIB.addTargetAddress(new OctetString("notification"),
                               TransportDomains.transportDomainUdpIpv4,
                               new OctetString(new 
UdpAddress("localhost/162").getValue()),
                               200, 1,
                               new OctetString("notify"),
                               new OctetString("v2c"),
                               StorageType.permanent);



But when i tried this in a Linux machine with localhost it works. But when 
i changed to remote host it gives the below exception.....


 targetMIB.addTargetAddress(new OctetString("notification"),
                               TransportDomains.transportDomainUdpIpv4,
                               new OctetString(new 
UdpAddress("10.203.121.88/162").getValue()),
                               200, 1,
                               new OctetString("notify"),
                               new OctetString("v2c"),
                               StorageType.permanent);




java.io.IOException: Invalid argument
        at java.net.PlainDatagramSocketImpl.send(Native Method)
        at java.net.DatagramSocket.send(DatagramSocket.java:612)
        at 
org.snmp4j.transport.DefaultUdpTransportMapping.sendMessage(Unknown
Source)
        at org.snmp4j.MessageDispatcherImpl.sendMessage(Unknown Source)
        at org.snmp4j.MessageDispatcherImpl.sendPdu(Unknown Source)
        at org.snmp4j.Snmp.sendMessage(Unknown Source)
        at org.snmp4j.Snmp.send(Unknown Source)
        at org.snmp4j.Snmp.send(Unknown Source)
        at
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.sendNotification(NotificationOriginatorImpl.java:252)
        at
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.notify(NotificationOriginatorImpl.java:318)
        at
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.notify(NotificationOriginatorImpl.java:143)
        at
org.snmp4j.agent.BaseAgent.sendColdStartNotification(BaseAgent.java:412)
        at org.snmp4j.agent.test.TestAgent.main(TestAgent.java:345)


Please give a solution if you have....

Thanks in advance,

Vinoj.






***********************  Aricent- Confidential   ***********************
"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of 
the individual to whom it is addressed. It may contain privileged or confidential information and should not be 
circulated or used for any purpose other than for what it is intended. If you have received this message in error, 
please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly
prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for 
loss or damage arising from the use of the information transmitted by this email including damage from virus."


More information about the SNMP4J mailing list