本文整理汇总了Java中com.sun.jmx.snmp.SnmpMessage类的典型用法代码示例。如果您正苦于以下问题:Java SnmpMessage类的具体用法?Java SnmpMessage怎么用?Java SnmpMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SnmpMessage类属于com.sun.jmx.snmp包,在下文中一共展示了SnmpMessage类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendTrapMessage
import com.sun.jmx.snmp.SnmpMessage; //导入依赖的package包/类
/**
* 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++;
}
示例2: sendTrapMessage
import com.sun.jmx.snmp.SnmpMessage; //导入依赖的package包/类
/**
* 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++;
}