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

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

?? hungrypeer.java

?? JXTA技術手冊 書上3.4.5章的源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
        try {            // extract the RestoPeer service from the RestoNet peergroup            // advertisement since it is now part of the RestoNet Peergroup            ID  msrvID = null;            PipeAdvertisement restoPipe = null;            // get the Spec ID for the RestoPeerService to lookup the service            // in the Peergroug handle            try {                msrvID = IDFactory.fromURL(new URL("urn", "",                         RestoPeerService.Module_Spec_ID));            } catch (java.net.MalformedURLException e) {            } catch (java.net.UnknownServiceException e) {                System.err.println(" Can't create restoPeer PipeID: UnknownServiceException ") ;                System.exit(1);            }            // lookup for the RestoPeer peergroup service            // we have to wait to make sure the service was completly initialized            // before we can lookup the service            while (restoSrv == null) {                try {                    Thread.sleep(2000);                    restoSrv = (RestoPeerService) restoNet.lookupService(msrvID);                } catch (Exception ex) { // This is ok                }            }            // Extract the pipe advertisement from the RestoPeer service module            // implementation advertisement. Get the ModuleImpl advertisement            // associated with the service            ModuleImplAdvertisement restoImpl = (ModuleImplAdvertisement)                restoSrv.getImplAdvertisement();            // extract the pipe from the param section of the Module Implementation            restoPipe = (PipeAdvertisement)                AdvertisementFactory.newAdvertisement((TextElement)                      restoImpl.getParam().getChildren().nextElement());            // save the pipe            restoPeerAdvs.addElement(restoPipe);            ++found;        } catch (Exception ex) {            System.out.println("Failure to connect to RestoPeer service pipe");            ex.printStackTrace();        }        // Completed RestoPeer Discovery        System.out.println("Found " + found + " RestoPeers Service");    }    // 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("Attempt 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 in RestoPeers connected structure                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 with        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                // the fries request. Insert the document                //in the message                msg.addElement(msg.newMessageElement("Request", mimeType,                     request.getStream()));                // send the auction message to the RestoPeer connected                // pipe                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 got 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()) {// interupted                        // 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. Let's            // 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. Let's print it                System.out.println("Received Fries Bid from RestoPeers (" +                                   brand + ") at a Price ($" + price +                                   ") \nRestoPeers Special (" + specials + ")");            } catch (Exception e) { // Error extracting bid from the message                System.out.println("Error extracting bid from the message");                continue; // broken content;            }        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区四区在线免费观看| 5858s免费视频成人| 中文幕一区二区三区久久蜜桃| 久久av老司机精品网站导航| 精品久久一区二区| 国产91丝袜在线播放| 亚洲欧美日韩久久| 欧美剧在线免费观看网站| 午夜精品一区二区三区电影天堂| 欧美精品色综合| 久久精品久久精品| 国产精品区一区二区三区| 色综合中文字幕国产 | 成人精品国产免费网站| 欧美国产激情二区三区| 91美女精品福利| 午夜伦欧美伦电影理论片| 欧美成人女星排行榜| 不卡的电视剧免费网站有什么| 亚洲欧美另类久久久精品| 欧美三级在线播放| 久久99国产精品成人| 国产精品网站在线观看| 欧美三级一区二区| 国内精品久久久久影院薰衣草| 国产精品久久777777| 欧美日韩久久不卡| 高清视频一区二区| 无码av免费一区二区三区试看| 久久久91精品国产一区二区精品| 91免费看`日韩一区二区| 日产精品久久久久久久性色| 欧美激情在线一区二区| 在线播放欧美女士性生活| 粉嫩久久99精品久久久久久夜| 亚洲一区二区在线播放相泽| 亚洲视频免费看| 精品日韩在线一区| 色哟哟精品一区| 国产成人精品一区二区三区四区| 亚洲精品国产a| 国产日韩综合av| 日韩一区二区电影网| jizzjizzjizz欧美| 精品制服美女久久| 亚洲va韩国va欧美va| 激情综合五月天| 亚洲午夜精品网| 国产精品国产三级国产aⅴ中文 | 激情综合网最新| 亚洲成人资源网| 亚洲天堂成人网| 久久久亚洲午夜电影| 日韩一区二区在线观看| 欧美性受极品xxxx喷水| 成人av电影免费观看| 国内精品嫩模私拍在线| 日本免费在线视频不卡一不卡二| 亚洲黄色小视频| 中文字幕一区视频| 欧美国产欧美亚州国产日韩mv天天看完整 | heyzo一本久久综合| 国产一区欧美二区| 麻豆精品蜜桃视频网站| 午夜成人免费电影| 亚洲国产一区二区三区青草影视| 国产农村妇女精品| 国产亚洲va综合人人澡精品| 日韩无一区二区| 88在线观看91蜜桃国自产| 欧美网站一区二区| 欧美主播一区二区三区美女| 色老头久久综合| 色偷偷成人一区二区三区91 | 久久99精品久久久久久| 日韩高清不卡在线| 日韩精品欧美成人高清一区二区| 亚洲一区在线视频观看| 一区二区三区在线观看欧美| 亚洲免费观看在线观看| 亚洲欧洲在线观看av| 亚洲丝袜精品丝袜在线| 亚洲男同性恋视频| 亚洲日本中文字幕区| 亚洲三级久久久| 亚洲午夜激情网站| 日韩精彩视频在线观看| 久久精品国产久精国产爱| 经典一区二区三区| 成人妖精视频yjsp地址| 91在线观看美女| 欧美无人高清视频在线观看| 欧美精品乱码久久久久久按摩| 91精品国产色综合久久ai换脸| 日韩欧美在线一区二区三区| 精品国产污污免费网站入口 | 欧美日韩中文字幕精品| 欧美日本视频在线| 欧美一区二区在线视频| 久久久久99精品一区| 国产蜜臀av在线一区二区三区| 国产精品毛片无遮挡高清| 亚洲黄色免费网站| 亚洲国产aⅴ成人精品无吗| 午夜欧美电影在线观看| 国产一区二区三区免费在线观看| 成人国产电影网| 色中色一区二区| 日韩三级在线观看| 亚洲丝袜美腿综合| 日韩av电影一区| 高清国产一区二区| 欧美亚洲一区二区在线| 欧美不卡在线视频| 亚洲欧洲日韩一区二区三区| 日韩成人av影视| www.日韩av| 亚洲成a人片在线观看中文| 韩国女主播成人在线观看| www..com久久爱| 91麻豆精品国产91久久久| 国产精品美女久久久久久久| 性久久久久久久久久久久| 成人一区在线看| 欧美一区二视频| 亚洲靠逼com| 国产在线视视频有精品| 欧美三级中文字幕| 国产精品美女久久久久久久久久久| 同产精品九九九| 成人av免费在线播放| 日韩一区国产二区欧美三区| 亚洲精品中文在线影院| 国产一区二区三区在线观看免费视频| 99综合电影在线视频| 精品国产a毛片| 日本免费新一区视频| 日本高清免费不卡视频| 欧美国产日产图区| 激情综合色综合久久综合| 91精品福利在线| 中文字幕日韩一区| 国产自产2019最新不卡| 欧美一区二区三区喷汁尤物| 亚洲欧美区自拍先锋| 高清成人在线观看| 亚洲精品在线三区| 日本一区中文字幕| 欧美男女性生活在线直播观看| 亚洲人吸女人奶水| 懂色av一区二区三区蜜臀| 精品88久久久久88久久久| 亚洲成国产人片在线观看| 色噜噜狠狠成人网p站| 国产精品久久久久久久久免费樱桃 | 3751色影院一区二区三区| 亚洲精品成人天堂一二三| av在线不卡免费看| 国产女人水真多18毛片18精品视频| 久久精品免费看| 日韩一级二级三级| 日韩av成人高清| 3d动漫精品啪啪1区2区免费| 偷拍自拍另类欧美| 91精品久久久久久蜜臀| 亚洲成人av电影在线| 欧美日韩国产精选| 洋洋成人永久网站入口| 91视频观看免费| 亚洲欧美日韩国产综合在线| 91麻豆精品秘密| 一区二区三区成人| 在线观看视频91| 亚洲一级二级在线| 欧美日韩午夜影院| 免费看日韩a级影片| 日韩免费福利电影在线观看| 韩日欧美一区二区三区| 国产午夜亚洲精品羞羞网站| 丁香亚洲综合激情啪啪综合| 一色屋精品亚洲香蕉网站| 在线一区二区三区做爰视频网站| 亚洲一区二区在线视频| 欧美精品黑人性xxxx| 裸体歌舞表演一区二区| 久久精子c满五个校花| 波多野结衣在线aⅴ中文字幕不卡| 国产精品第13页| 欧美在线视频不卡| 蜜臀精品久久久久久蜜臀| 国产日韩欧美综合一区| 99视频在线精品| 亚洲一区在线观看免费 | 91香蕉视频污在线| 怡红院av一区二区三区| 日韩一级高清毛片| 日韩av中文字幕一区二区| 99久久精品国产麻豆演员表| 久久久精品欧美丰满| 91在线丨porny丨国产|