/** * Send the specified message on trapSocket. */ private void sendTrapMessage(SnmpMessage msg) throws IOException, SnmpTooBigException { byte[] buffer = new byte[bufferSize] ; DatagramPacket packet = new DatagramPacket(buffer, buffer.length) ; int encodingLength = msg.encodeMessage(buffer) ; packet.setLength(encodingLength) ; packet.setAddress(msg.address) ; packet.setPort(msg.port) ; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, "sendTrapMessage", "sending trap to " + msg.address + ":" + msg.port); } trapSocket.send(packet) ; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, "sendTrapMessage", "sent to " + msg.address + ":" + msg.port); } snmpOutTraps++; snmpOutPkts++; }