Package net.tomp2p.connection

Examples of net.tomp2p.connection.DiscoverResults


            //TODO: make this generic
          Bindings b = new Bindings().addInterface("wlp3s0");
            master = new PeerBuilder(new Number160(rnd)).bindings(b).ports(4000).enableMaintenance(false).start();
            client = new PeerBuilder(new Number160(rnd)).bindings(b).ports(4001).enableMaintenance(false).start();

            DiscoverResults dr = master.connectionBean().channelServer().discoverNetworks().currentDiscoverResults();
            if(dr.existingBroadcastAddresses().size() == 0) {
              System.err.println("this test does not work if none of your interfaces supports broadcast");
            } else {
              System.err.println(dr.existingBroadcastAddresses());
            }
           
            BaseFuture tmp = client.ping().broadcast().port(4000).start();
            tmp.awaitUninterruptibly();
            System.err.println(tmp.failedReason());
View Full Code Here


                        if (!peer.peerAddress().inetAddress().equals(seenAs.inetAddress())) {
                            // check if we have this interface in that we can
                            // listen to
                            Bindings bindings2 = new Bindings().addAddress(seenAs.inetAddress());
                         
                            DiscoverResults discoverResults = DiscoverNetworks.discoverInterfaces(bindings2);
                            String status = discoverResults.status();
                            LOG.info("2nd interface discovery: {}", status);
                            if (discoverResults.newAddresses().size() > 0
                                    && discoverResults.newAddresses().contains(seenAs.inetAddress())) {
                                serverAddress = serverAddress.changeAddress(seenAs.inetAddress());
                                peer.peerBean().serverPeerAddress(serverAddress);
                                LOG.info("we were having the wrong interface, change it to: {}", serverAddress);
                            } else {
                                // now we know our internal IP, where we receive
View Full Code Here

    }

    //FutureLateJoin<FutureResponse>
    private FuturePing pingBroadcast(final int port) {
      final FuturePing futurePing = new FuturePing();
        final DiscoverResults discoverResults = peer.connectionBean().channelServer().discoverNetworks().currentDiscoverResults();
        final int size = discoverResults.existingBroadcastAddresses().size();
        final FutureLateJoin<FutureResponse> futureLateJoin = new FutureLateJoin<FutureResponse>(size, 1);
        if (size > 0) {

            FutureChannelCreator fcc = peer.connectionBean().reservation().create(size, 0);
            Utils.addReleaseListener(fcc, futurePing);
            fcc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
                @Override
                public void operationComplete(FutureChannelCreator future) throws Exception {
                    if (future.isSuccess()) {
                        addPingListener(futurePing, futureLateJoin);
                        for (InetAddress broadcastAddress: discoverResults.existingBroadcastAddresses()) {
                            final PeerAddress peerAddress = new PeerAddress(Number160.ZERO, broadcastAddress,
                                    port, port);
                            FutureResponse validBroadcast = peer.pingRPC().pingBroadcastUDP(
                                    peerAddress, future.channelCreator(), connectionConfiguration);
                            if (!futureLateJoin.add(validBroadcast)) {
View Full Code Here

TOP

Related Classes of net.tomp2p.connection.DiscoverResults

Copyright © 2018 www.massapicom. 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.