freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于dv算法的路由器模擬設(shè)計與實現(xiàn)實驗報告-閱讀頁

2025-07-10 01:17本頁面
  

【正文】 。 oos = new ObjectOutputStream(bos)。 bufferOut = ()。 datagramPacket = new DatagramPacket(bufferOut, ,serverInetAddress, severReceivePort)。 (轉(zhuǎn)發(fā)完畢\n)。 } } ()。 } catch (UnknownHostException e) { ()。 }finally{ ()。 }}package totalThreads。import 。import 。import 。import 。import 。/** * 每一個路由器線程都有的發(fā)送線程 * author 郭金磊 *since 20131220 */public class SendThread extends Thread { /** * 本路由器的路由表,里面還有RouterTable屬性,即是本路由器路由表的值。 /** * 用于發(fā)送路由表的socket */ private DatagramSocket receiveSocket。 } /** * 含有參數(shù)的構(gòu)造函數(shù) * param receiveSocket 用于發(fā)送路由表的socket * param router 本路由器的路由表,里面還有RouterTable屬性,即是本路由器路由表的值。 =receiveSocket。 } /** * 開啟發(fā)送線程,每隔1秒鐘就發(fā)送本路由表中的信息。 ObjectOutputStream oos = null。 DatagramPacket datagramPacket = null。 while(true) { try { DatagramSocket sendSocket=new DatagramSocket()。 TotalPacket totalPacket=new TotalPacket(sendTable)。 (())。 (routerTablePacket)。 oos = new ObjectOutputStream(bos)。 bufferOut = ()。inew NetMap().getInitInternetMap().length。 if(severReceivePort!=()){ datagramPacket = new DatagramPacket(bufferOut, ,serverInetAddress, severReceivePort)。 } } } (1000)。 }finally{ try { ()。 } catch (IOException e) { ()。import 。import 。import 。import 。import 。import 。import 。/** * 每一個路由器線程都有的接收線程 * author 郭金磊 *since 20131220 */public class ReceiveThread extends Thread{ /** * 注入的可以修改左邊區(qū)域顯示的routerArea */ private JTextArea routerAreaLeft。 /** * 注入的可以修改右下邊區(qū)域顯示的routerArea */ private JTextArea routerAreaRightSouth。 /** * 接收路由表的socket */ private DatagramSocket receiveSocket。 } /** * 含有參數(shù)初始化的構(gòu)造函數(shù) * param routerAreaLeft 注入的可以修改左邊區(qū)域顯示的routerArea * param routerAreaRightNorth 注入的可以修改右上邊區(qū)域顯示的routerArea * param routerAreaRightSouth 注入的可以修改右下邊區(qū)域顯示的routerArea * param receiveSocket 接收路由表的socket * param router 注入的可以更新的本路由器的路由表 */ public ReceiveThread(JTextArea routerAreaLeft,JTextArea routerAreaRightNorth,JTextArea routerAreaRightSouth,DatagramSocket receiveSocket,Router router) { super()。 = routerAreaRightNorth。 = receiveSocket。 } /** * 默認的開啟該接受線程,始終接受收到的鄰居路由表的信息 */ public synchronized void run() { DatagramPacket dataPacket =null。 ObjectInputStream ois =null。 while(true){ try { dataPacket = new DatagramPacket(bufferIn, )。 bis = new ByteArrayInputStream(())。 TotalPacket totalPacket = (TotalPacket) ()。 if(sendTable.equals(())){ routerTablePacket=()。 (收到了+sourceRouterId+的路由表\n)。 RouterTable tableTemp =()。 HashMapInteger,TimeCounter createTimerMapsForNeighbers=()。 long timeNow=()。 (sourceRouterId,timeNow)。 } if((sourceRouterId)){ timeCounter=(sourceRouterId)。 (sourceRouterId)。 (sourceRouterId, timeCounter)。 }else{ timeCounter=new TimeCounter(sourceRouterId,router)。 ()。 int [] nextHopsOld=().getNextHop()。 int [] dissOld=().getDistance()。 for(int i=0。i++){ if(sourceRouterId==nextHopsOld[i]){ nextHopsOld[i]=sourceRouterId。 }else{ dissOld[i]=dissNew[i]。amp。amp。 if(dissNew[i]16){ dissOld[i]=dissNew[i]+1。 } }else{ if(i!=()()amp。i!=()amp。nextHopsNew[i]!=0){ if(nextHopsOld[i]==0amp。nextHopsNew[i]!=()){ nextHopsOld[i]=sourceRouterId。 }else{ dissOld[i]=dissNew[i]。amp。amp。 if(dissNew[i]16){ dissOld[i]=dissNew[i]+1。 } }else if(nextHopsOld[i]!=0amp。nextHopsOld[i]!=nextHopsNew[i]amp。nextHopsNew[i]!=()){ if((dissNew[i]+1)dissOld[i]){ nextHopsOld[i]=sourceRouterId。 }else{ dissOld[i]=dissNew[i]。 } } catch (Exception e) { ()。 ()。 } } } } /** * 當收到新的路由表時,更新顯示新的路由表。 String distances=(())。 ()。 (下一跳是:\n+nextHops+\n)。 }}package totalThreads。import 。import 。import 。import 。import 。import 。import 。import 。 /** * 注入的可以修改右上邊區(qū)域顯示的routerArea */ private JTextArea routerAreaRightNorth。 /** * 注入的可以更新的本路由器的路由表 */ private Router router。 /** * 默認的構(gòu)造方法 */ public ForwardThread() { super()。 = routerAreaLeft。 = routerAreaRightSouth。 = router。 ByteArrayInputStream bis =null。 byte[] bufferIn = new byte[1024 * 1024]。 (dataPacket)。 ois = new ObjectInputStream(bis)。 ()。 int destRouterId=()。 byte [] data=()。 String datas=new String(data)。 (數(shù)據(jù)是:+datas+\n)。\n)。\n)。 ().setSourceRouterId(())。inew NetMap().getInitInternetMap().length。amp。 (我要轉(zhuǎn)發(fā)這個數(shù)據(jù)包給+forwardNextHopRouterId+\n)。 (轉(zhuǎn)發(fā)完畢。 }else if(().getNextHop()[i]==0){ (這個路由我不可達,\n我要丟棄該包。 break。 }finally{ try { ()。 } catch (IOException e) { ()。 * param forwardNextHopRouterId 要轉(zhuǎn)發(fā)的下一跳路由 * param totalPacketForward 要轉(zhuǎn)發(fā)的數(shù)據(jù)打成的包 */ public synchronized void forward(int forwardNextHopRouterId,TotalPacket totalPacketForward){ DatagramSocket sendSocket=null。 ObjectOutputStream oos = null。 byte[] bufferOut = new byte[1024 * 1024]。 InetAddress serverInetAddress =(localhost)。 oos = new ObjectOutputStream(bos)。 bufferOut = ()。 datagramPacket = new DatagramPacket(bufferOut, ,serverInetAddress, severReceivePort)。 } catch (SocketException e) { ()。 } catch (IOException e) { ()。 } }}package transportPacket。/** * 最后的包裝包實體類,不但可以傳輸數(shù)據(jù)包,還可以傳送路由表 * author 郭金磊 *since 20131220 */public class TotalPacket implements Serializable{ /** * 產(chǎn)生全局唯一的序列化的實體ID */ private static final long serialVersionUID = 7430514869915215965L。 /** * 如果發(fā)送的是路由
點擊復(fù)制文檔內(nèi)容
范文總結(jié)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1