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

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

?? restopeer.java

?? p2p 源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
import java.io.*;import java.util.*;import net.jxta.peergroup.PeerGroup;import net.jxta.peergroup.PeerGroupFactory;import net.jxta.exception.PeerGroupException;import net.jxta.document.AdvertisementFactory;import net.jxta.document.StructuredDocumentFactory;import net.jxta.document.Advertisement;import net.jxta.document.Element;import net.jxta.document.MimeMediaType;import net.jxta.document.StructuredDocument;import net.jxta.document.StructuredTextDocument;import net.jxta.document.StructuredDocumentUtils;import net.jxta.discovery.DiscoveryService;import net.jxta.pipe.PipeService;import net.jxta.pipe.InputPipe;import net.jxta.pipe.OutputPipe;import net.jxta.pipe.PipeID;import net.jxta.protocol.PipeAdvertisement;import net.jxta.protocol.PeerGroupAdvertisement;import net.jxta.protocol.ModuleImplAdvertisement;import net.jxta.protocol.ModuleClassAdvertisement;import net.jxta.protocol.ModuleSpecAdvertisement;import net.jxta.endpoint.Message;import net.jxta.platform.ModuleClassID;import net.jxta.platform.ModuleSpecID;import net.jxta.id.IDFactory;// RestoPeer represents a restaurant that receives auction requests// for french fries from HungryPeers. RestoPeers offers three sizes of// french fries (small, large, medium). Each restaurant assignes a// different price to each size. Each restaurant also offers a special// offering.//// Each resturant is uniquely identified by its brand name.//public class RestoPeer {    private PeerGroup netpg = null;      // The NetPeerGroup    private PeerGroup restoNet = null;   // The restoNet Peergroup    private String brand = "Chez JXTA";        // Brand of this restaurant    private String specials = "large ($3.00)"; // Current restaurant special    // Services within the RestoNet peergroup    private DiscoveryService disco = null;  // Discovery service    private PipeService pipes = null;       // Pipe service    private PipeAdvertisement myAdv = null; // My RestoPeer pipe advertisement    private InputPipe pipeIn = null;        // Input pipe that we listen to                                            // for requests from Hungry Peers    private int timeout = 3000;          // discovery wait timeout    private int rtimeout = 8000;         // resolver pipe timeout    public static void main(String args[]) {        RestoPeer myapp = new RestoPeer();        myapp.startJxta();        System.exit(0);    }    // Method to start the JXTA platform, join the RestoNet peergroup and    // advertise the RestoPeer service    private void startJxta() {        try {            //Discover and join (or start) the default peergroup            netpg = PeerGroupFactory.newNetPeerGroup();        } catch (PeerGroupException e) {            //Couldn't initialize; can't continue            System.out.println("Fatal error : creating the NetPeerGroup");            System.exit(1);        }        // Discover (or create) and join the RestoNet peergroup        try {            joinRestoNet();        } catch (Exception e) {            System.out.println("Can't join or create RestoNet");            System.exit(1);        }        // Discover (or create) and publish a RestoPeer pipe to receive        // auction request for fries from HungryPeers        if (!createRestoPipe()) {            System.out.println("Aborting due to failure to create RestoPeer pipe");            System.exit(1);        }        // Advertise the RestoPeerService        createRestoPeerService();        // Start the RestoPeer server loop to respond to Hungry peers        // fries requests.        handleFriesRequest();    }    // Discover (or create) and join the RestoNet peergroup    private void joinRestoNet() throws Exception {        int count = 3;   // maximun number of attempts to discover        System.out.println("Attempting to Discover the RestoNet PeerGroup");        // Get the discovery service from the NetPeergroup        DiscoveryService hdisco = netpg.getDiscoveryService();        Enumeration ae = null;   // Holds the discovered peers        // Loop until wediscover the RestoNet or        // until we've exhausted the desired number of attempts        while (count-- > 0) {            try {                // search first in the peer local cache to find                // the RestoNet peergroup advertisement                ae = hdisco.getLocalAdvertisements(DiscoveryService.GROUP,                                          "Name", "RestoNet");                // If we found the RestoNet advertisement we are done                if ((ae != null) && ae.hasMoreElements())                    break;                // If we did not find it, we send a discovery request                hdisco.getRemoteAdvertisements(null,                       DiscoveryService.GROUP, "Name", "RestoNet", 1, null);                // Sleep to allow time for peers to respond to the                // discovery request                try {                    Thread.sleep(timeout);                } catch (InterruptedException ie) {}            } catch (IOException e){                // Found nothing! Move on            }        }        PeerGroupAdvertisement restoNetAdv = null;        // Check if we found the RestoNet advertisement.        // If we didn't, then either        //       we are the first peer to join or        //       no other RestoNet peers are up.        // In either case, we must create the RestoNet peergroup        if (ae == null || !ae.hasMoreElements()) {            System.out.println(                 "Could not find the RestoNet peergroup; creating one");            try {                // Create a new, all-purpose peergroup.                ModuleImplAdvertisement implAdv =                    netpg.getAllPurposePeerGroupImplAdvertisement();                restoNet = netpg.newGroup(                                null,             // Assign new group ID                                implAdv,          // The implem. adv                                "RestoNet",       // Name of peergroup                                "RestoNet, Inc.");// Description of peergroup                // Get the PeerGroup Advertisement                restoNetAdv = netpg.getPeerGroupAdvertisement();            } catch (Exception e) {                System.out.println("Error in creating RestoNet Peergroup");                throw e;            }        } else {            // The RestoNet advertisement was found in the cache;            // that means we can join the existing RestoNet peergroup            try {                restoNetAdv = (PeerGroupAdvertisement) ae.nextElement();                restoNet = netpg.newGroup(restoNetAdv);                System.out.println(                    "Found the RestoNet Peergroup advertisement");            } catch (Exception e) {                System.out.println("Error in creating RestoNet PeerGroup from existing adv");                throw e;            }        }        try {            // Get the discovery and pipe services for the RestoNet Peergroup            disco = restoNet.getDiscoveryService();            pipes = restoNet.getPipeService();        } catch (Exception e) {            System.out.println("Error getting services from RestoNet");            throw e;        }        System.out.println("RestoNet Restaurant (" + brand + ") is on-line");        return;    }    // Method to handle fries auction requests from HungryPeers.    // The method waits for HungryPeer requests pipe messages to arrive.    // Incoming requests contain a pipe advertisement to respond to    // the HungryPeers requester and a fries size.  The method    // generates a bid offer for the request, opens an output pipe to    // the HungryPeer requester, and send the response.    private void handleFriesRequest() {        InputStream ip = null;               // Input Stream to read message        PipeAdvertisement hungryPipe = null; // HungryPeer Requester pipe        StructuredDocument request = null;   // Request document        StructuredDocument bid = null;       // Response document        // Document mime types        MimeMediaType mimeType = new MimeMediaType("text", "xml");        Element el = null;                   // Element in document        String name = null;                  // Name of the sender        String size = null;                  // Fries size Requested        OutputPipe pipeOut = null;           // Output pipe to respond to                                             // HungryPeer requester        System.out.println("RestoNet Restaurant (" + brand +                           ") waiting for HungryPeer requests");        // Loop waiting for HungryPeer Requests        while (true) {            Message msg = null;          // Incoming pipe message            try {                // Block until a message arrive on the RestoPeer pipe                msg = pipeIn.waitForMessage();                // If message is null discard message                if (msg == null) {                   if (Thread.interrupted()) {                        // We have been asked to stop                        System.out.println("Abort: RestoPeer interrupted");                        return;                    }                }                // We received a message; extract the request                try {                    // Extract the HungryPipe pipe information                    // to reply to the sender                    ip = msg.getElement("HungryPeerPipe").getStream();                    // Construct the associated pipe advertisement                    // via the AdvertisementFactory                    hungryPipe = (PipeAdvertisement)                    AdvertisementFactory.newAdvertisement(mimeType, ip);                    // Extract the sender name and fries size requested                    // building a StructuredDocument                    ip = msg.getElement("Request").getStream();                    request = StructuredDocumentFactory.newStructuredDocument                                    (mimeType, ip);                    // Extract the fields from the structured Document                    Enumeration enum = request.getChildren();                    // Loop over all the elements of the document                    while (enum.hasMoreElements()) {                        el = (Element) enum.nextElement();                        String attr = (String) el.getKey();                        String value = (String) el.getValue();                        // Extract the HungryPeer Requester Name                        if (attr.equals("Name")) {                            name = value;                            continue;                        }                        // Extract the Fries  size requested                        else if (attr.equals("Fries")) {                            size = value;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品国自产拍av| 日韩一级完整毛片| 国产99久久久久久免费看农村| 亚洲国产成人av网| 亚洲综合一区在线| 亚洲国产欧美在线| 天天影视网天天综合色在线播放| 亚洲一区二区三区在线播放| 亚洲国产精品视频| 午夜久久久影院| 蜜桃传媒麻豆第一区在线观看| 日本大胆欧美人术艺术动态 | 国产成人啪免费观看软件| 美女mm1313爽爽久久久蜜臀| 狠狠色伊人亚洲综合成人| **网站欧美大片在线观看| 亚洲欧洲日韩av| 亚洲成人免费看| 九九久久精品视频| 成人黄色国产精品网站大全在线免费观看| 国产91在线观看| 日本高清不卡一区| 欧美一区二区美女| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 91在线一区二区三区| 91成人看片片| 精品国偷自产国产一区| 国产精品免费视频一区| 亚洲成a人v欧美综合天堂下载| 蜜乳av一区二区三区| 国产精品996| 欧洲中文字幕精品| 欧美精品一区二区在线观看| 国产精品美女久久久久久久久久久 | 免费在线视频一区| 粉嫩高潮美女一区二区三区| 91在线无精精品入口| 欧美一区二区三区在线看| 国产亚洲人成网站| 石原莉奈在线亚洲二区| 成人午夜大片免费观看| 欧美午夜不卡视频| 国产日韩欧美综合在线| 亚洲一二三四久久| 国产成人av网站| 欧美一区二区视频网站| 亚洲免费伊人电影| 国产成人自拍高清视频在线免费播放| 91亚洲精品久久久蜜桃| 精品毛片乱码1区2区3区| 一级女性全黄久久生活片免费| 国内精品伊人久久久久av一坑 | 亚洲摸摸操操av| 国产一区二区三区在线观看免费| 色婷婷久久久久swag精品| 欧美精品一区二区三区视频| 亚洲一区二区三区在线看| 成人理论电影网| 欧美xxxxx牲另类人与| 亚洲1区2区3区4区| 日本精品免费观看高清观看| 久久无码av三级| 久久av资源站| 欧美一区二区三区思思人| 亚洲精品高清视频在线观看| 成人伦理片在线| 国产精品五月天| 风间由美一区二区三区在线观看 | 中文字幕日韩av资源站| 国产精品亚洲视频| 久久综合九色综合97婷婷女人| 秋霞午夜av一区二区三区| 欧美老肥妇做.爰bbww视频| 夜夜夜精品看看| 欧美日韩在线亚洲一区蜜芽| 一区二区三区在线免费视频| 99re免费视频精品全部| 最好看的中文字幕久久| fc2成人免费人成在线观看播放| 精品嫩草影院久久| 国产精品一区二区你懂的| 久久久久久夜精品精品免费| 国模无码大尺度一区二区三区| 久久一二三国产| 成人免费高清在线| 亚洲免费观看视频| 欧美亚洲国产一区在线观看网站| 亚洲国产三级在线| 日韩欧美在线综合网| 久久国产精品99精品国产| 久久久噜噜噜久久中文字幕色伊伊| 国产永久精品大片wwwapp| 国产欧美综合色| 色www精品视频在线观看| 亚洲一级二级在线| 日韩无一区二区| 丁香网亚洲国际| 亚洲精品国产视频| 欧美一区午夜视频在线观看| 加勒比av一区二区| 中文字幕国产一区| 欧美日韩的一区二区| 国产在线看一区| 亚洲三级在线观看| 欧美一区二区三区的| 国产精品456| 亚洲一区中文日韩| 欧美成人精精品一区二区频| jlzzjlzz欧美大全| 日本人妖一区二区| 亚洲人123区| 欧美大片一区二区三区| 成人av电影在线观看| 性做久久久久久久免费看| 久久蜜桃一区二区| 在线电影院国产精品| 成人免费看视频| 日本成人在线视频网站| 亚洲人成网站精品片在线观看| 日韩西西人体444www| aaa欧美日韩| 久久精品国产99国产| 日韩理论在线观看| 亚洲精品一区二区精华| 欧美乱妇15p| aa级大片欧美| 高清国产午夜精品久久久久久| 天堂在线亚洲视频| 亚洲美女屁股眼交| 欧美国产日本韩| 欧美成人aa大片| 538在线一区二区精品国产| 99久久99久久综合| 国产成人aaa| 韩国理伦片一区二区三区在线播放| 亚洲精选一二三| 亚洲婷婷综合色高清在线| 久久看人人爽人人| 日韩一级二级三级精品视频| 欧美性受xxxx| 在线观看免费成人| 色偷偷久久人人79超碰人人澡| 国产九色sp调教91| 国产精品888| 国产毛片一区二区| 国产盗摄一区二区| 风间由美一区二区av101 | 亚洲午夜久久久久| 亚洲美女精品一区| 一片黄亚洲嫩模| 樱桃视频在线观看一区| 亚洲欧美区自拍先锋| 亚洲欧美偷拍另类a∨色屁股| 国产精品私房写真福利视频| 国产视频在线观看一区二区三区| 欧美变态tickling挠脚心| 日韩欧美在线不卡| 精品人在线二区三区| 2023国产精品视频| 精品国产91洋老外米糕| 久久综合九色综合欧美亚洲| 久久久午夜精品| 中文字幕av资源一区| 日韩伦理av电影| 亚洲第一成人在线| 免费看欧美美女黄的网站| 国产毛片精品国产一区二区三区| 国产成人av电影免费在线观看| 国产91精品在线观看| 99精品欧美一区二区蜜桃免费| 欧美自拍丝袜亚洲| 欧美成人乱码一区二区三区| 久久久久久久综合狠狠综合| 国产精品视频免费看| 亚洲韩国精品一区| 麻豆精品一区二区综合av| 成人妖精视频yjsp地址| 色中色一区二区| 欧美一区二区三区日韩| 精品国产麻豆免费人成网站| 国产精品免费视频一区| 亚洲第一二三四区| 国产精品一区在线| 91久久精品一区二区| 精品国产sm最大网站免费看| 国产精品乱子久久久久| 天天操天天干天天综合网| 国产一区二区导航在线播放| 色噜噜狠狠成人网p站| 日韩欧美专区在线| 亚洲激情成人在线| 精品一区中文字幕| 一本在线高清不卡dvd| 精品粉嫩aⅴ一区二区三区四区| 国产精品久久午夜| 久久国产剧场电影| 欧美天天综合网| 欧美激情中文不卡| 青娱乐精品在线视频| 一本高清dvd不卡在线观看|