本文整理匯總了Java中es.tid.ospf.ospfv2.OSPFPacketTypes類的典型用法代碼示例。如果您正苦於以下問題:Java OSPFPacketTypes類的具體用法?Java OSPFPacketTypes怎麽用?Java OSPFPacketTypes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OSPFPacketTypes類屬於es.tid.ospf.ospfv2包,在下文中一共展示了OSPFPacketTypes類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import es.tid.ospf.ospfv2.OSPFPacketTypes; //導入依賴的package包/類
public void run(){
log.info("run ruun");
int tipo = 1;
RawSocket socket = new RawSocket();
try{
if (socket.isOpen())
{
log.info("el socket YA esta abierto");
}
else
{
socket.open(PF_INET, 89);
}
if (!(socket.isOpen())){
log.info("Error el socket no se ha abierto");
}
socket.setUseSelectTimeout(true);
socket.setSendTimeout(TIMEOUT);
socket.setReceiveTimeout(TIMEOUT);
if (this.multicast){
String mCast="224.0.0.5";
//String bindAddr="0.0.0.0";
socket.setIPHeaderInclude(false);
socket.joinGroup(InetAddress.getByName(mCast), nodeLocalAddress);
log.info("OSPF Multicast RAW Socket opened");
}
else{
socket.bind(nodeLocalAddress);
log.info("OSPF Unicast RAW Socket opened");
}
}catch(IOException e){
log.error("Exception produced::"+e.toString());
}
while(true) {
try {
OSPFv2Packet ospfv2Packet =readOSPFv2Packet(socket);
if (ospfv2Packet != null){
if (ospfv2Packet.getType() == OSPFPacketTypes.OSPFv2_LINK_STATE_UPDATE){
ospfv2PacketQueue.add((OSPFv2LinkStateUpdatePacket)ospfv2Packet);
/*
* Redis database if requested
*/
if(redisOspfv2PacketQueue != null){
redisOspfv2PacketQueue.add((OSPFv2LinkStateUpdatePacket)ospfv2Packet);
}
}
}
} catch (Exception e1) {
e1.printStackTrace();
log.warn("OSPF Socket ends::"+e1.toString());
return;
}
}
}