Package java.net

Examples of java.net.InetAddress$InetAddressHolder


     
      byte[]  bytes = new byte[4];
     
      buffer.get( bytes );
     
      InetAddress inet_address = InetAddress.getByAddress( bytes );
     
      new proxyStateV5RequestPort( "", inet_address );
     
      return( true );
    }
View Full Code Here


      connection.setConnectState( this );
     
      target_channel = SocketChannel.open();
     
        InetAddress bindIP = NetworkAdmin.getSingleton().getMultiHomedOutgoingRoundRobinBindAddress(address.getAddress());
       
          if ( bindIP != null ){
           
            target_channel.socket().bind( new InetSocketAddress( bindIP, 0 ) );
          }
View Full Code Here

  public static boolean
  testIfAzureusIP(
    final String  ip )
  {
    try{
      InetAddress address = HostNameToIPResolver.syncResolve( ip );
     
      final String host_address = address.getHostAddress();
     
      if ( platform_ips.contains( host_address )){
 
        return( true );
      }
View Full Code Here

                  {
                    public void
                    localAddressChanged(
                      DHTPluginContact  local_contact )
                    {
                      InetAddress latest_dht_address = local_contact.getAddress().getAddress();
                                             
                      if ( sameFamily( internal_address, latest_dht_address )){
                     
                        dht_address     = latest_dht_address;
                        dht_address_time  = SystemTime.getCurrentTime();
View Full Code Here

 
  protected void
  readConfig(
    boolean  first_time )
  {
    InetAddress  new_internal_address  = NetworkAdmin.getSingleton().getSingleHomedServiceBindAddress();
   
    if ( new_internal_address == null ){
     
      try{
        new_internal_address = InetAddress.getByName( "0.0.0.0" );
View Full Code Here

  }
 
  protected InetAddress
  readExternalAddress()
  {
    InetAddress   external_address = null;

      // no point in kicking off any queries if we're closing
   
    if ( manager.isClosing()){
     
      external_address  = last_external_address;
     
      if ( external_address == null ){
       
        try{
          external_address = InetAddress.getByName("127.0.0.1");
         
        }catch( Throwable e ){
         
          Debug.printStackTrace(e);
        }
      }
     
      return( external_address );
    }
             
      DHTPlugin dht = adapter.getDHTPlugin();
           
        // if DHT has informed us of an address then we use this - most reliable up to date one
        // unless the version server cache time is more recent
     
      if ( dht_address != null && dht_address_time <= SystemTime.getCurrentTime()){
       
        AZInstanceManagerAdapter.VCPublicAddress a = adapter.getVCPublicAddress();

        if ( a != null ){
         
          long cache_time = a.getCacheTime();
         
          if ( cache_time <= dht_address_time ){
           
            external_address = dht_address;
          }
        }
      }

      if (   external_address == null &&
          ( dht == null || dht.getStatus() != DHTPlugin.STATUS_RUNNING )){
   
          // use cached version if available and the DHT isn't

        AZInstanceManagerAdapter.VCPublicAddress a = adapter.getVCPublicAddress();
           
      if ( a != null ){
       
        try{
         
          external_address  = InetAddress.getByName( a.getAddress());
         
        }catch( Throwable e ){
         
          Debug.printStackTrace(e);
        }
      }
    }
   
    if ( external_address == null && dht != null  ){
     
        // no cache, use DHT (this will hang during initialisation, hence the use of cached
        // version above
     
      try{
        InetAddress latest_dht_address = dht.getLocalAddress().getAddress().getAddress();
       
          // ignore any v6 addresses from DHT
       
        if ( sameFamily( internal_address, latest_dht_address )){
         
View Full Code Here

      if ( !buddy.isOnline( false )){
       
        continue;
      }
     
      InetAddress ip       = buddy.getAdjustedIP();
     
      if ( ip == null ){
       
        continue;
      }
     
      int      tcp_port  = buddy.getTCPPort();
      int      udp_port  = buddy.getUDPPort();
     
      List  downloads = (List)entry.getValue();
     
      for (int i=0;i<downloads.size();i++){
       
        Download  download = (Download)downloads.get(i);
       
        PeerManager pm = download.getPeerManager();
       
        if ( pm == null ){
         
          continue;
        }
       
        Peer[] existing_peers = pm.getPeers( ip.getHostAddress());
     
        boolean  connected = false;
       
        for (int j=0;j<existing_peers.length;j++){
         
          Peer peer = existing_peers[j];
         
          if (   peer.getTCPListenPort() == tcp_port ||
              peer.getUDPListenPort() == udp_port ){
           
            connected = true;
           
            break;
         
        }
       
        if ( connected ){
         
          log( download.getName() + " - peer " + ip.getHostAddress() + " already connected" );
         
          continue;
        }
       
        log( download.getName() + " - connecting to peer " + ip.getHostAddress());

        PEPeerManager c_pm = PluginCoreUtils.unwrap( pm );
       
        Map  user_data = new LightHashMap();
       
        user_data.put( PEER_KEY, download );
       
        user_data.put( Peer.PR_PRIORITY_CONNECTION, new Boolean( true ));
       
        c_pm.addPeer( ip.getHostAddress(), tcp_port, udp_port, true, user_data );
      }
    }
  }
View Full Code Here

                       
              if ( d instanceof DeviceMediaRendererImpl ){
                 
                DeviceMediaRendererImpl r = (DeviceMediaRendererImpl)d;
                 
                InetAddress device_address = r.getAddress();
                 
                if ( device_address != null && device_address.equals( address )){
                   
                  if ( r.isAlive() != alive ){
                   
                    if ( alive ){
                     
View Full Code Here

             
                if ( device instanceof DeviceMediaRendererImpl ){
               
                  DeviceMediaRendererImpl renderer = (DeviceMediaRendererImpl)device;
                 
                  InetAddress device_address = renderer.getAddress();
                 
                  try{
                    if ( device_address != null ){
                           
                        // just test on IP, should be OK
                     
                      if ( device_address.equals( client_address.getAddress())){
         
                        if ( renderer.canFilterFilesView()){
                       
                          boolean  skip = false;
                         
View Full Code Here

   
    DeviceImpl[] devices = manager.getDevices();

    for ( final Map.Entry<InetAddress, String> entry: ud.entrySet()){
     
      InetAddress  address = entry.getKey();
     
      boolean already_assoc = false;

      for ( DeviceImpl d: devices ){
               
        if ( d instanceof DeviceMediaRendererImpl ){
         
          DeviceMediaRendererImpl r = (DeviceMediaRendererImpl)d;
         
          InetAddress device_address = r.getAddress();
         
          if ( d.isAlive() && device_address != null && device_address.equals( address )){
           
            already_assoc = true;
           
            break;
          }
View Full Code Here

TOP

Related Classes of java.net.InetAddress$InetAddressHolder

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.