Package net.tomp2p.p2p

Examples of net.tomp2p.p2p.Peer.peerAddress()


            recv1 = new PeerBuilder(new Number160("0x1234")).p2pId(55).ports(8088).start();
            new PingRPC(recv1.peerBean(), recv1.connectionBean(), false, true, false);
            FutureChannelCreator fcc = recv1.connectionBean().reservation().create(0, 1);
            fcc.awaitUninterruptibly();
            cc = fcc.channelCreator();
            FutureResponse fr = handshake.pingTCP(recv1.peerAddress(), cc,
                    new DefaultConnectionConfiguration());
            fr.awaitUninterruptibly();
            Assert.assertEquals(false, fr.isSuccess());
        } finally {
            if (cc != null) {
View Full Code Here


                    return "world!";
                }
            });
           
            String sentObject = "Hello";
            FutureDirect fd = peer1.sendDirect(peer2.peerAddress()).object(sentObject).start();
            System.out.println("send " + sentObject);
            fd.awaitUninterruptibly();
           
            System.out.println("received " + fd.object() + " connections: "
                    + ccohTCP.total()+ "/"+ccohUDP.total());
View Full Code Here

           
            System.out.println("received " + fd.object() + " connections: "
                    + ccohTCP.total()+ "/"+ccohUDP.total());
           
            // keep the connection for 20s alive. Setting -1 means to keep it open as long as possible
            FuturePeerConnection futurePeerConnection = peer1.createPeerConnection(peer2.peerAddress(), timeout);
           
            fd = peer1.sendDirect(futurePeerConnection).object(sentObject).start();
            System.out.println("send " + sentObject);
            fd.awaitUninterruptibly();
            System.out.println("received " + fd.object() + " connections: "
View Full Code Here

            List<FutureResponse> list = new ArrayList<FutureResponse>(50);
            FutureChannelCreator fcc = recv1.connectionBean().reservation().create(0, 50);
            fcc.awaitUninterruptibly();
            cc = fcc.channelCreator();
            for (int i = 0; i < 50; i++) {
                FutureResponse fr = sender.pingRPC().pingTCP(recv1.peerAddress(), cc,
                        new DefaultConnectionConfiguration());
                list.add(fr);
            }
            for (FutureResponse fr2 : list) {
                fr2.awaitUninterruptibly();
View Full Code Here

            for (int i = 0; i < 20; i++) {
                FutureChannelCreator fcc = recv1.connectionBean().reservation().create(0, 50);
                fcc.awaitUninterruptibly();
                ChannelCreator cc = fcc.channelCreator();
                for (int j = 0; j < 50; j++) {
                    FutureResponse fr = sender.pingRPC().pingTCP(recv1.peerAddress(), cc,
                            new DefaultConnectionConfiguration());
                    list.add(fr);
                }
                for (FutureResponse fr2 : list) {
                    fr2.awaitUninterruptibly();
View Full Code Here

            for (int i = 0; i < 20; i++) {
                FutureChannelCreator fcc = recv1.connectionBean().reservation().create(50, 0);
                fcc.awaitUninterruptibly();
                ChannelCreator cc = fcc.channelCreator();
                for (int j = 0; j < 50; j++) {
                    FutureResponse fr = sender.pingRPC().pingUDP(recv1.peerAddress(), cc,
                            new DefaultConnectionConfiguration());
                    list.add(fr);
                }
                int ii = 0;
                for (FutureResponse fr2 : list) {
View Full Code Here

            sender = new PeerBuilder(new Number160("0x9876")).p2pId(55).ports(2424).start();
            recv1 = new PeerBuilder(new Number160("0x1234")).p2pId(55).ports(8088).start();
            FutureChannelCreator fcc = recv1.connectionBean().reservation().create(0, 1);
            fcc.awaitUninterruptibly();
            ChannelCreator cc = fcc.channelCreator();
            FutureResponse fr = sender.pingRPC().pingTCP(recv1.peerAddress(), cc,
                    new DefaultConnectionConfiguration());
            Utils.addReleaseListener(cc, fr);
            fr.awaitUninterruptibly();
            fr.awaitListeners();
            Assert.assertEquals(true, fr.isSuccess());
View Full Code Here

                    new DefaultConnectionConfiguration());
            Utils.addReleaseListener(cc, fr);
            fr.awaitUninterruptibly();
            fr.awaitListeners();
            Assert.assertEquals(true, fr.isSuccess());
            FutureResponse fr2 = sender.pingRPC().pingTCP(recv1.peerAddress(), cc,
                    new DefaultConnectionConfiguration());
            fr2.awaitUninterruptibly();
            fr2.awaitListeners();
            // we have released the reservation here
            // System.err.println(fr2.getFailedReason());
View Full Code Here

    Bindings b = new Bindings().addProtocol(StandardProtocolFamily.INET).addAddress(
            InetAddress.getByName("127.0.0.1"));
    // b.addInterface("eth0");
    Peer master = new PeerBuilder(new Number160(rnd)).ports(4000).bindings(b).start();
    System.out.println("Server started Listening to: " + DiscoverNetworks.discoverInterfaces(b));
    System.out.println("address visible to outside is " + master.peerAddress());
    while (true) {
      for (PeerAddress pa : master.peerBean().peerMap().all()) {
        System.out.println("PeerAddress: " + pa);
        FutureChannelCreator fcc = master.connectionBean().reservation().create(1, 1);
        fcc.awaitUninterruptibly();
View Full Code Here

    Bindings b = new Bindings().addProtocol(StandardProtocolFamily.INET).addAddress(
            InetAddress.getByName("127.0.0.1"));
    // b.addInterface("eth0");
    Peer client = new PeerBuilder(new Number160(rnd)).ports(4001).bindings(b).start();
    System.out.println("Client started and Listening to: " + DiscoverNetworks.discoverInterfaces(b));
    System.out.println("address visible to outside is " + client.peerAddress());

    InetAddress address = Inet4Address.getByName(ipAddress);
    int masterPort = 4000;
    PeerAddress pa = new PeerAddress(Number160.ZERO, address, masterPort, masterPort);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.