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

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

?? 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产呦萝稀缺另类资源| 91精品国产综合久久精品| 欧美日韩三级一区二区| 久久久综合九色合综国产精品| 中文字幕永久在线不卡| 麻豆专区一区二区三区四区五区| 成人av高清在线| 精品国产三级电影在线观看| 亚洲国产乱码最新视频 | 久久久久久久精| 亚洲青青青在线视频| 国产麻豆一精品一av一免费 | 亚洲一区二区高清| 国产风韵犹存在线视精品| 欧美三区免费完整视频在线观看| 国产亚洲美州欧州综合国| 美女视频黄 久久| 欧美日韩在线精品一区二区三区激情 | 欧美剧在线免费观看网站| 亚洲欧美另类综合偷拍| 成人免费视频一区二区| 26uuu精品一区二区在线观看| 日韩精品亚洲专区| 日本韩国欧美三级| 国产精品毛片大码女人| 国产精品一二三四| 精品国产百合女同互慰| 久久99精品久久久久久国产越南| 欧美男人的天堂一二区| 亚洲午夜电影在线观看| 在线一区二区三区做爰视频网站| 中文字幕一区二区三中文字幕| 国产成人亚洲综合色影视| 精品日韩在线观看| 人禽交欧美网站| 欧美丝袜自拍制服另类| 亚洲v中文字幕| 欧美日韩午夜在线| 日欧美一区二区| 91精品在线观看入口| 青青草91视频| 精品国免费一区二区三区| 国产最新精品精品你懂的| 久久久www成人免费毛片麻豆| 狠狠色丁香久久婷婷综合丁香| 亚洲精品在线免费观看视频| 久久99精品国产91久久来源| 久久蜜桃一区二区| 国产69精品久久久久777| 欧美激情艳妇裸体舞| 91视频91自| 天天射综合影视| 精品免费视频一区二区| 国产成人无遮挡在线视频| 国产亚洲精品久| 色综合天天视频在线观看| 亚洲国产精品久久人人爱蜜臀| 欧美欧美午夜aⅴ在线观看| 蜜桃视频在线一区| 久久欧美中文字幕| 91啪在线观看| 青青草97国产精品免费观看| xfplay精品久久| 色悠久久久久综合欧美99| 日韩成人一区二区三区在线观看| 日韩精品一区二区三区四区视频| 国产91在线看| 亚洲成人动漫在线免费观看| 精品久久久久久久人人人人传媒 | 欧美日本在线看| 国产做a爰片久久毛片| 国产精品不卡视频| 欧美日韩视频不卡| 国产成a人亚洲| 亚洲一区二区三区在线| 久久久久久久久久久久久女国产乱| 91在线视频观看| 美女国产一区二区| 亚洲精选免费视频| 久久综合av免费| 欧美性色欧美a在线播放| 久久99国产精品久久| 一区二区三区日本| 国产日韩欧美高清在线| 3atv在线一区二区三区| 成人黄色av电影| 日本美女视频一区二区| 亚洲视频一区在线观看| 国产亚洲一区字幕| 在线不卡一区二区| 99久久国产综合色|国产精品| 老司机午夜精品| 亚洲国产综合视频在线观看| 国产精品视频第一区| 精品国产乱码久久久久久1区2区 | 日韩电影免费在线| 亚洲男人天堂一区| 国产三级欧美三级| 精品入口麻豆88视频| 51精品国自产在线| 欧美三级在线看| 色综合一个色综合| 国产成人在线看| 精品一区二区三区视频在线观看| 性做久久久久久免费观看 | 91麻豆国产精品久久| 国内不卡的二区三区中文字幕| 日韩黄色免费电影| 亚洲精品菠萝久久久久久久| 中文字幕制服丝袜成人av| 亚洲国产成人私人影院tom| 精品久久久久久亚洲综合网 | 欧美日本视频在线| 91捆绑美女网站| 99久久精品国产毛片| 99久久99久久综合| 成人av网站大全| 99久久精品一区| 91亚洲国产成人精品一区二区三 | 日韩三级av在线播放| 欧美喷水一区二区| 欧美一区午夜精品| 欧美va亚洲va在线观看蝴蝶网| 日韩精品专区在线影院观看| 日韩一区二区在线观看| 精品美女在线播放| 久久尤物电影视频在线观看| 久久先锋资源网| 亚洲国产精品精华液2区45| 国产精品免费久久久久| 国产精品污污网站在线观看| 亚洲免费观看视频| 夜夜嗨av一区二区三区中文字幕| 一区二区三区四区亚洲| 亚洲一区二区三区中文字幕 | 日韩欧美一二区| 欧美精品一区视频| 国产精品美女一区二区| 亚洲欧美激情插| 午夜激情久久久| 久久精品国产免费| 成人午夜在线播放| 91黄色激情网站| 制服丝袜激情欧洲亚洲| 丰满亚洲少妇av| 国产成人av资源| 一本到不卡免费一区二区| 欧美视频在线播放| 欧美va亚洲va香蕉在线| 综合欧美一区二区三区| 图片区小说区国产精品视频| 韩国三级在线一区| 99国产精品国产精品毛片| 欧美麻豆精品久久久久久| 久久网站热最新地址| 亚洲人吸女人奶水| 久久99精品久久久久久国产越南| 成人av高清在线| 6080国产精品一区二区| 国产精品国产自产拍高清av王其 | 欧美日韩视频在线一区二区| 精品嫩草影院久久| 亚洲激情在线激情| 国产在线视视频有精品| 在线观看日韩精品| 久久综合九色综合97婷婷| 一区二区三区成人| 狠狠色狠狠色综合系列| 欧美亚日韩国产aⅴ精品中极品| 精品国产91亚洲一区二区三区婷婷 | 精品久久人人做人人爱| 亚洲精品成人悠悠色影视| 国产麻豆精品视频| 欧美日韩国产天堂| 国产精品国产三级国产有无不卡 | av网站免费线看精品| 欧美一区二区三区色| 18欧美乱大交hd1984| 麻豆国产精品777777在线| 91国偷自产一区二区三区观看| 日韩欧美国产一区二区在线播放 | 亚洲视频1区2区| 国产一区二区三区免费| 欧美一二区视频| 亚洲成人av一区二区| 91啪九色porn原创视频在线观看| 亚洲精品一区二区三区香蕉 | 91精品国产一区二区人妖| 亚洲自拍偷拍网站| 91玉足脚交白嫩脚丫在线播放| 国产欧美一区二区精品性色 | 丝袜美腿亚洲综合| 在线观看亚洲精品| 一区二区三区国产| 欧美性大战久久久久久久蜜臀| 亚洲女同女同女同女同女同69| 99热在这里有精品免费| 国产精品卡一卡二| 成人av动漫网站| 亚洲视频香蕉人妖|