[email]mike_stephanos@yahoo.com[/email] (mike_stephanos@yahoo.com) writes:
> I got a java program from a JAVA SNMP Stack which is sending a snmp
> trap pdu
>
> it runs OK on NT but on UNIX I got: a java exception: address already
> in use: cannot bind
>
>
> How can I make this program running?
> .......................
> static DatagramSocket dSocket;
> static final int SNMP_TRAP_PORT = 162;
> dSocket = new DatagramSocket(SNMP_TRAP_PORT);
>
> SNMPMessage message = new SNMPMessage(version, community, pdu);
>
>
> DatagramPacket outPacket = new DatagramPacket(messageEncoding,
> messageEncoding.length, hostAddress, SNMP_TRAP_PORT);
> dSocket.send(outPacket);
>
> .................
>
> thanks for any help
The program you are running--have you tried running it as root?

I'm far from a sockets programming guru, but it's possible that your
program may need to run as root in order to bind to the ports needed
to initiate that SNMP communication. UDP or TCP 162 are the
destination ports for SNMP traps, but I'm not sure what port your
program may be attempting to bind to when it sends the trap.

Also, what hostAddress are you defining? Is it valid, and is there a
route to it?

--
Todd H.
[url]http://www.toddh.net/[/url]