亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hungrypeer.java

?? p2p 源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
        // Try to find at least two RestoPeers (an arbitrary number)        // RestoPeers are found by their pipe advertisements        while (count-- >0) {            try {                // Check if we already have restaurant advertisements                // in our local peer cache                Enumeration ae =                    disco.getLocalAdvertisements(DiscoveryService.ADV,                                     "name", "RestoNet:RestoPipe:*");                // If we found some advertisements in the cache,                // add them to the list                if (ae != null && ae.hasMoreElements()) {                    // Reset count and RestoPeerAdvs as we have                    // just retrieved all advertisements, including                    // previously cached ones                    found = 0;                    restoPeerAdvs.removeAllElements();                    while (ae.hasMoreElements()) {                        restoPeerAdvs.addElement(ae.nextElement());                        ++found;                    }                    if (found > 1)                        break;     // Want to find at least two                }                // Did not find enough advertisement in the cache.                // Send a remote discovery request to search for                // more RestoPeer advertisements                disco.getRemoteAdvertisements(null,                             DiscoveryService.ADV,                             "name", "RestoNet:RestoPipe:*", 5, null);                // Give the peers a chance to respond                try {                    Thread.sleep(timeout);                } catch (InterruptedException e) {}            } catch (IOException e){                // Found nothing! Move on            }        }        // Completed RestoPeer Discovery        System.out.println("Found " + found + " RestoPeers(s)");    }    // Method to connect and open output pipes to all the    // RestoPeers that we have discovered. Each RestoPeer is    // identified by its unique RestoPeer pipe advertisement.    private void connectToRestoPeers() {        // Enumerate all the RestoPeer pipe advertisments we have discovered        // and attempt to connect a pipe which each of them        for (Enumeration en = restoPeerAdvs.elements();             en.hasMoreElements();) {            PipeAdvertisement padv = (PipeAdvertisement) en.nextElement();            try {                System.out.println(                    "Attempting to connect to discovered RestoPeer");                // Create an output pipe connection to the RestoPeer                OutputPipe pipeOut = pipes.createOutputPipe(padv,                                                            rtimeout);                // Check if we have a connected pipe                if (pipeOut == null) {                    // Failed; go to next RestoPeer                    System.out.println(                        "Failure to connect to RestoPeer Pipe:" +                        padv.getName());                    continue;                }                // Save the output pipe                restoPeerPipes.addElement(pipeOut);                System.out.println("Connected pipe to " + padv.getName());            } catch (Exception e) {                // Error during connection go to next RestoPeer                System.out.println("RestoPeer may not be there anymore:" +                                    padv.getName());                 continue;            }        }    }    // Send an auction request for French Fries to all the RestoPeer    // pipes we have successfully connected    private void sendFriesAuctionRequests() {        // Enumerate all the RestoPeer pipe connections we have successfully        // connected to        for (Enumeration en = restoPeerPipes.elements();            en.hasMoreElements();) {            OutputPipe op = (OutputPipe) en.nextElement();            try {                // Construct the request document                StructuredDocument request  =                    StructuredDocumentFactory.newStructuredDocument(mimeType,                    "RestoNet:Request");                // Fill up the Fries auction request argument                Element re;                re = request.createElement("Name", myIdentity);                request.appendChild(re);                re = request.createElement("Fries", friesRequest);                request.appendChild(re);                // Create the pipe message to send                Message msg = pipes.createMessage();                // Fill the first message element which is the HungryPeer                // pipe advertisement return address. We need this                // so RestoPeers can respond to us                msg.addElement(msg.newMessageElement("HungryPeerPipe",                         mimeType, myAdv.getDocument(mimeType).getStream()));                // Fill the second message element, which is                // the fries request. Insert the document                // in the message                msg.addElement(msg.newMessageElement("Request",                         mimeType, request.getStream()));                // Send the auction message to the RestoPeer                op.send(msg);                System.out.println("Sent Fries Auction Request ("                    + friesRequest + ") to connected peers");            } catch (Exception ex) {                // Error sending auction request                System.out.println(                    "Failed to send auction request to RestoPeer");            }        }    }    // Receive bid requests from RestoPeers on the    // HungryPeer listening pipe    private void receiveFriesBids() {        // Continue until we get all answers        while (true) {            Message msg = null;      // Pipe message received            String price = null;     // Fries price bid            String brand = null;     // RestoPeer name which offers the bid            String specials = null;  // Specials offer bid            InputStream ip = null;   // Input stream to read message element            StructuredDocument bid = null; //Bid document received            try {                // Wait for a bid message to arrive from a RestoPeer                // Will block until a message arrive                msg = myPipe.waitForMessage();                // Check if the message is valid                if (msg == null) {                    if (Thread.interrupted()) {                        // We have been asked to stop                        System.out.println(                            "Abort Receiving bid loop interrupted");                        myPipe.close(); // Close the Pipe                        return;                    }                }            } catch (Exception ex) {                // Error in receiving message                myPipe.close();                System.out.println("Abort Receiving Error receiving bids");                return;            }            // We got a message from a RestoPeer.            // Extract and display infomation about the bid received.            try {                // Extract the Bid document from the message                ip = msg.getElement("Bid").getStream();                bid = StructuredDocumentFactory.newStructuredDocument(                            mimeType, ip);                // Parse the document to extract bid information                Enumeration enum = bid.getChildren();                while (enum.hasMoreElements()) {                    Element element = (Element) enum.nextElement();                    String attr = (String) element.getKey();                    String value = (String) element.getValue();                    if (attr.equals("Price")) {                        price = value;                        continue;                    }                    if (attr.equals("Brand")) {                        brand = value;                        continue;                    }                    if (attr.equals("Specials")) {                        specials = value;                        continue;                    }                }                // We got a valid bid. Print it.                System.out.println("Received Fries Bid from RestoPeers (" +                           brand + ") at a Price ($" + price +                           ") \nRestoPeers Special (" + specials + ")");            } catch (Exception e) {                // Broken content                System.out.println("Error extracting bid from the message");                continue;            }        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
青青草国产精品亚洲专区无| 中文在线一区二区| 欧美日免费三级在线| 欧美中文字幕亚洲一区二区va在线| 色综合久久天天| 一卡二卡欧美日韩| 欧美人动与zoxxxx乱| 婷婷六月综合亚洲| 不卡在线视频中文字幕| 欧美日韩第一区日日骚| 成人美女视频在线看| 日韩电影一二三区| 成人午夜伦理影院| 国产色综合久久| 国产精品资源在线看| 欧美一区二区三区在线视频| 亚洲一区二区视频在线观看| 91麻豆免费视频| 在线观看视频一区二区欧美日韩| 欧美写真视频网站| 欧美日韩视频专区在线播放| 日韩一区二区影院| 91精品国产综合久久久蜜臀粉嫩| 成人av高清在线| 国产91精品一区二区麻豆网站| 琪琪一区二区三区| 欧美一区二视频| 亚洲激情成人在线| 日韩影院免费视频| 久久99精品一区二区三区| 亚洲精品老司机| 久久国产生活片100| 国产成人一级电影| 暴力调教一区二区三区| 国产91综合一区在线观看| 久久精品国产在热久久| 欧美亚日韩国产aⅴ精品中极品| 99re这里只有精品6| 在线观看日韩高清av| 亚洲永久精品大片| 成人sese在线| 欧美在线视频不卡| 久久66热偷产精品| 亚洲一区二区中文在线| 欧美疯狂做受xxxx富婆| 国产91高潮流白浆在线麻豆| 亚洲国产一区在线观看| 一级中文字幕一区二区| 亚洲一区二区成人在线观看| 色天使久久综合网天天| 天天做天天摸天天爽国产一区| 欧美日韩国产高清一区二区 | 国产日韩欧美制服另类| 日本不卡视频一二三区| 国产一区二区久久| 欧美最猛性xxxxx直播| 欧美www视频| 国产精品久久久久久久久免费桃花 | 喷水一区二区三区| 精品国产成人在线影院| 成人一区二区视频| 亚洲成人资源网| 久久久久久9999| 337p亚洲精品色噜噜狠狠| 大白屁股一区二区视频| 亚洲成人一区二区在线观看| 中文字幕不卡在线| 欧美精品久久99| 欧美综合色免费| 日韩免费一区二区三区在线播放| 美女国产一区二区| 欧美精品国产精品| 国产麻豆欧美日韩一区| 日韩一区二区电影| 五月婷婷另类国产| 国产精品天美传媒| 在线观看日产精品| 国产精品一区二区在线观看不卡 | 久久久久久夜精品精品免费| 国产精品丝袜一区| 色婷婷综合久久久久中文 | 在线成人小视频| 免费在线视频一区| 亚洲欧美日韩国产综合| 日韩精品资源二区在线| 欧美男人的天堂一二区| 欧亚洲嫩模精品一区三区| 色综合久久久久| 91免费国产在线观看| 99久久婷婷国产综合精品电影| 国产91色综合久久免费分享| 国产传媒久久文化传媒| 国产精品亚洲成人| 成人免费看视频| 99久久国产免费看| 91福利精品视频| 欧美日韩一区 二区 三区 久久精品| 欧美中文字幕亚洲一区二区va在线| 欧美在线视频全部完| 日韩欧美国产精品一区| 久久亚洲综合色一区二区三区 | 一区二区三区不卡视频在线观看| 怡红院av一区二区三区| 免费观看91视频大全| 国产伦精品一区二区三区免费迷| 色欧美片视频在线观看| 欧美在线免费播放| 精品免费视频一区二区| 亚洲婷婷综合久久一本伊一区| 国产精品初高中害羞小美女文| 亚洲国产成人高清精品| 国产中文字幕一区| 欧美色老头old∨ideo| 久久久午夜精品| 免费成人在线影院| 99精品久久只有精品| 久久夜色精品国产欧美乱极品| 亚洲欧美日本在线| 国产一区 二区| 91麻豆精品国产91久久久资源速度 | 国产精品麻豆欧美日韩ww| 日韩电影在线免费看| 97久久超碰国产精品| 久久久久久久久99精品| 五月婷婷综合网| 欧美日韩精品专区| 亚洲线精品一区二区三区八戒| 99久久久免费精品国产一区二区| 久久久精品免费免费| 国内精品国产三级国产a久久| 91精品国产色综合久久ai换脸| 欧美极品少妇xxxxⅹ高跟鞋 | 日韩欧美精品在线| 首页国产丝袜综合| 欧美精品777| 性感美女久久精品| 欧美精选午夜久久久乱码6080| 亚洲综合在线免费观看| 欧美肥妇毛茸茸| 在线观看视频一区二区欧美日韩| 欧美日韩高清一区二区不卡| 亚洲福利一区二区| 日韩视频国产视频| 国产黑丝在线一区二区三区| 国产精品亲子乱子伦xxxx裸| 在线观看日韩精品| 日韩国产欧美在线观看| 亚洲色欲色欲www| 欧美裸体bbwbbwbbw| 国模少妇一区二区三区| 18成人在线观看| 日韩欧美国产麻豆| 99久久99久久精品免费观看| 日韩精品成人一区二区三区| 亚洲国产高清在线| 正在播放亚洲一区| 色综合久久久久久久久| 狠狠色丁香九九婷婷综合五月| 国产精品久久久久aaaa樱花| 日韩欧美国产系列| 91成人免费电影| av综合在线播放| 激情综合色播五月| 日本不卡高清视频| 亚洲国产成人高清精品| 亚洲精品videosex极品| 中文字幕av一区二区三区| 337p日本欧洲亚洲大胆精品| 91精品国产色综合久久不卡蜜臀| 91浏览器入口在线观看| 成人自拍视频在线观看| 狠狠色狠狠色合久久伊人| 日产国产欧美视频一区精品| 一区二区免费看| 亚洲福利视频导航| 视频一区二区三区入口| 亚洲大片在线观看| 日本网站在线观看一区二区三区| 亚洲人成网站在线| 亚洲影院久久精品| 偷窥少妇高潮呻吟av久久免费| 日韩专区一卡二卡| 久久精品国产精品青草| 国产麻豆视频一区| 成人97人人超碰人人99| 91麻豆国产在线观看| 欧美日韩一级大片网址| 91精品国产综合久久精品app| 欧美浪妇xxxx高跟鞋交| 日韩欧美一级二级三级| 国产精品久久久久久久久动漫| 成人免费一区二区三区在线观看| 亚洲综合男人的天堂| 看电影不卡的网站| 成人动漫视频在线| 欧美久久高跟鞋激| 国产精品国产三级国产| 石原莉奈一区二区三区在线观看| 国产精品456| 欧美精品少妇一区二区三区|