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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? restopeer.java

?? p2p 源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
import java.io.*;import java.util.*;import java.net.URL; import net.jxta.peergroup.PeerGroup;import net.jxta.peergroup.PeerGroupFactory;import net.jxta.peergroup.PeerGroupID;import net.jxta.exception.PeerGroupException;import net.jxta.discovery.DiscoveryService;import net.jxta.document.AdvertisementFactory;import net.jxta.document.Advertisement;import net.jxta.document.Element;import net.jxta.document.MimeMediaType;import net.jxta.document.StructuredTextDocument;import net.jxta.document.StructuredDocumentFactory;import net.jxta.document.StructuredDocument;import net.jxta.document.StructuredDocumentUtils;import net.jxta.pipe.PipeService;import net.jxta.pipe.PipeID;import net.jxta.protocol.PipeAdvertisement;import net.jxta.protocol.PeerGroupAdvertisement;import net.jxta.protocol.ModuleSpecAdvertisement;import net.jxta.protocol.ModuleImplAdvertisement;import net.jxta.id.IDFactory;import net.jxta.id.ID;import net.jxta.platform.ModuleClassID;import net.jxta.platform.ModuleSpecID;import net.jxta.impl.peergroup.StdPeerGroupParamAdv;// 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    // 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 int timeout = 3000;          // discovery wait timeout    // IDs within RestoNet    private ModuleClassID mcID = IDFactory.newModuleClassID();    private ModuleSpecID  msID = IDFactory.newModuleSpecID(mcID);    private static PeerGroupID restoPeerGroupID;   // main method to start our RestoPeer    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);        }        // Wait while we process requests        synchronized(RestoPeer.class) {            try {                RestoPeer.class.wait();	    } catch (InterruptedException ie) {	        System.out.println("Interrupted; exiting");	    }        }    }        // 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 the RestoNetPeerGroup		restoNet = createRestoPeerGroup();				// 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;    }    // This method is used to create a new instance of    // the RestoNet peergroup.    // Peergroups are implemented as modules.    // Modules are used in JXTA  to load and manage dynamic code on a peer.    //    // A peergroup is represented by a set of advertisements:     //  1) A peergroup advertisement that advertises the peergroup    //  2) A module spec advertisement that uniquely    //         specifies the peergroup (set of peergroup services)    //  3) A module impl advertisement that describes a    //         peergroup implementation    // This method must create all these advertisements    private PeerGroup createRestoPeerGroup() {	// Use a unique PeerGroup id as a constant so that the same	// peergroup ID is used each time the RestoNet Peergroup is created.	// It is essential that each RestoPeer use the same unique ID	// so that two peers do not create different IDs for the	// RestoNet peergroup. 	//	// The UUID in the URL constructor was generated via the	// Shell mkpgrp command that created a new peergroup with a	// unique peergroup ID.        try {            restoPeerGroupID = (PeerGroupID) IDFactory.fromURL(                  new URL("urn", "",                          "jxta:uuid-4d6172676572696e204272756e6f202002"));        } catch (java.net.MalformedURLException e) {            System.err.println("Can't create restoPeerGroupID: " + e);            System.exit(1);        } catch (java.net.UnknownServiceException e) {            System.err.println("Can't create restoPeerGroupID: " + e);            System.exit(1);        }	// Create a new Module Implementation advertisement that will	// represent the new RestoPeer peergroup service	// Assign a new SpecID that uniquely identifies the RestoPeer	// peergroup service. Ths spec ID must be shared between all	// instances of the RestoNet peergroup; it again is created via	// the mkpgrp Shell command.	ModuleSpecID  msrvID = null;	try {	    msrvID = (ModuleSpecID) IDFactory.fromURL(new URL("urn","",		"jxta:uuid-737D1ED776B043E7A8718B102B62055A614CAC047AD240A8960ABDE6F7847C2306"));	} catch (java.net.MalformedURLException e) {             System.err.println("Can't create restoPeer Spec Id:" + e);            System.exit(1);        } catch (java.net.UnknownServiceException e) {            System.err.println("Can't create restoPeer Spec Id:" + e);            System.exit(1);        }        	// Create a pipe advertisement to be used by Hungry Peers	// to communicate with the RestoNet peergroup service	PipeAdvertisement myAdv = (PipeAdvertisement)	    AdvertisementFactory.newAdvertisement(	    PipeAdvertisement.getAdvertisementType());			// Again we assign a hardwired ID to the pipe, so everytime a	// peer recreates the RestoNet peergroup, the same pipe id	// is used.	try {	    myAdv.setPipeID((PipeID) IDFactory.fromURL(new URL("urn","",              "jxta:uuid-9CCCDF5AD8154D3D87A391210404E59BE4B888209A2241A4A162A10916074A9504")));	} catch (java.net.MalformedURLException e) {            System.err.println("Can't create restoPeer PipeID: " + e);            System.exit(1);        } catch (java.net.UnknownServiceException e) {            System.err.println(" Can't create restoPeer PipeID: " + e);            System.exit(1);        }        	// The symbolic name of the pipe is built from

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产精品专区| 欧美丰满高潮xxxx喷水动漫| 国产色爱av资源综合区| 国产自产高清不卡| 久久久亚洲综合| 成人免费毛片片v| 亚洲视频1区2区| 欧美午夜精品理论片a级按摩| 亚洲精品成人悠悠色影视| 色综合色狠狠天天综合色| 亚洲一区中文在线| 日韩一区二区在线观看视频| 国产美女视频91| 中文字幕日韩一区| 欧美精品在线视频| 国产在线精品一区二区不卡了| 日本一区二区三区高清不卡| 91香蕉视频污| 免费人成黄页网站在线一区二区| 久久久久久99久久久精品网站| 成人午夜电影网站| 亚洲网友自拍偷拍| 精品99一区二区三区| 99麻豆久久久国产精品免费优播| 亚洲一区二区三区美女| 337p粉嫩大胆噜噜噜噜噜91av| 国产suv精品一区二区6| 亚洲一区二区欧美日韩| wwww国产精品欧美| 欧美日韩一区在线| 国产精品系列在线观看| 一区二区高清免费观看影视大全 | 国产a级毛片一区| 亚洲欧美激情在线| 日韩免费一区二区| 精品国产露脸精彩对白| 成人黄页在线观看| 麻豆成人免费电影| 一区二区三区日韩精品视频| 精品久久久久久久人人人人传媒 | 成人欧美一区二区三区黑人麻豆 | 欧美日韩中字一区| 粉嫩高潮美女一区二区三区| 日本最新不卡在线| 亚洲区小说区图片区qvod| 精品福利av导航| 欧美人妇做爰xxxⅹ性高电影| 国产剧情一区在线| 石原莉奈在线亚洲二区| 亚洲日本中文字幕区| 久久免费视频一区| 日韩一区二区三区在线视频| 色欧美88888久久久久久影院| 国产精品综合一区二区三区| 美女在线一区二区| 一区二区三区91| 亚洲三级免费观看| 国产精品水嫩水嫩| 精品sm捆绑视频| 欧美xxxxxxxx| 欧美一区二区视频网站| 国产欧美精品一区| 欧美不卡123| 日韩一区二区三区在线视频| 欧美人狂配大交3d怪物一区| 欧美三级资源在线| 欧洲色大大久久| 在线一区二区视频| 色婷婷亚洲精品| 色综合久久66| 91高清视频免费看| 91蝌蚪porny成人天涯| 99久久精品99国产精品 | 日本视频一区二区| 偷拍亚洲欧洲综合| 日韩精品一二三四| 青椒成人免费视频| 精品一区二区久久久| 日韩国产欧美在线播放| 欧美a级一区二区| 久久精品国产澳门| 国产乱人伦偷精品视频不卡| 国产乱人伦精品一区二区在线观看 | 亚洲欧美在线aaa| 国产精品久久福利| 亚洲欧美怡红院| 亚洲一区av在线| 日韩成人av影视| 麻豆成人在线观看| 国产福利一区在线观看| 成人性生交大片免费看中文| 波多野结衣在线一区| 99国产精品国产精品毛片| 欧美天天综合网| 日韩一区国产二区欧美三区| 久久综合久久综合九色| 中文字幕一区二区三区在线播放 | 亚洲综合清纯丝袜自拍| 亚洲成a人片在线观看中文| 麻豆精品一区二区av白丝在线| 国产一区激情在线| 99久久精品免费精品国产| 色94色欧美sute亚洲线路二| 7777精品伊人久久久大香线蕉的 | 亚洲黄一区二区三区| 五月综合激情日本mⅴ| 精品伊人久久久久7777人| 成人自拍视频在线观看| 欧美在线制服丝袜| 精品精品国产高清一毛片一天堂| 国产精品电影一区二区三区| 天堂久久久久va久久久久| 精品一区二区三区在线播放| 99久久亚洲一区二区三区青草| 欧美伊人久久久久久午夜久久久久| 日韩欧美亚洲一区二区| 中文字幕永久在线不卡| 午夜婷婷国产麻豆精品| 国产成人免费网站| 欧美日韩国产在线观看| 国产色爱av资源综合区| 天天色综合天天| 国产suv精品一区二区883| 欧美群妇大交群的观看方式| 久久久久久久久久久黄色| 亚洲成人免费视频| 5858s免费视频成人| 国产日韩欧美在线一区| 亚洲大型综合色站| 99久久久国产精品免费蜜臀| 日韩一区二区不卡| 亚洲精品乱码久久久久久日本蜜臀| 青青草国产精品亚洲专区无| 色综合久久久久| 久久老女人爱爱| 日本视频中文字幕一区二区三区| jlzzjlzz国产精品久久| 精品日韩成人av| 日韩专区在线视频| 日本道精品一区二区三区| 国产午夜亚洲精品羞羞网站| 奇米777欧美一区二区| 欧美色中文字幕| 最新成人av在线| 成人午夜电影网站| 国产亚洲成aⅴ人片在线观看| 免费观看成人鲁鲁鲁鲁鲁视频| 91福利在线观看| 亚洲色图欧美偷拍| 成人动漫中文字幕| 久久精品夜色噜噜亚洲a∨| 青青草精品视频| 欧美一区中文字幕| 视频一区欧美日韩| 欧美男女性生活在线直播观看| 亚洲欧美日韩电影| 97se亚洲国产综合在线| 中文字幕一区在线观看| 成人高清在线视频| 国产精品毛片久久久久久久| 国产精品亚洲午夜一区二区三区 | 欧美日韩免费高清一区色橹橹| 中文字幕中文字幕一区二区 | 国产精品电影一区二区| 成人在线一区二区三区| 国产精品美女久久久久久| 国产精品一区二区久久不卡| 久久久精品日韩欧美| 国内外成人在线视频| 久久精品免视看| 国产成人在线视频播放| 国产精品久久久久三级| 99久久er热在这里只有精品66| 中文字幕av一区二区三区| 丰满白嫩尤物一区二区| 18涩涩午夜精品.www| 色综合天天做天天爱| 久久91精品久久久久久秒播| 日韩视频免费观看高清完整版在线观看| 日本中文一区二区三区| 日韩一区二区在线观看视频| 激情五月婷婷综合| 亚洲国产成人在线| 91看片淫黄大片一级| 亚洲欧美国产三级| 在线电影国产精品| 久久国内精品视频| 亚洲国产精品传媒在线观看| 99久久久免费精品国产一区二区 | 亚洲成va人在线观看| 91精品国产aⅴ一区二区| 国产资源在线一区| 成人免费在线视频观看| 欧美久久一二三四区| 久久99久国产精品黄毛片色诱| 久久综合狠狠综合久久综合88 | 在线一区二区视频| 玖玖九九国产精品| 国产精品毛片高清在线完整版| 欧美在线一区二区三区|