Package org.jmule.core.edonkey.packet.tag

Examples of org.jmule.core.edonkey.packet.tag.IntTag


      return "";
    }
  }

  void setSoftLimit(int softLimit) {
    Tag tag = new IntTag(SL_SOFTFILES, softLimit);
    tagList.removeTag(SL_SOFTFILES);
    tagList.addTag(tag);

  }
View Full Code Here


      return 0;
    }
  }

  void setHardLimit(int hardLimit) {
    Tag tag = new IntTag(SL_HARDFILES, hardLimit);
    tagList.removeTag(SL_HARDFILES);
    tagList.addTag(tag);
  }
View Full Code Here

      return 0;
    }
  }
 
  void setPing(int receivedChallenge)  {
    Tag tag = new IntTag(SL_PING, Convert.longToInt(System.currentTimeMillis() - last_udp_response));
    tagList.removeTag(SL_PING);
    tagList.addTag(tag);
    last_udp_response = System.currentTimeMillis();
    sended_challenge = 0;
  }
View Full Code Here

    }
  }

  void setNumUsers(long numUsers) {
    last_udp_response = System.currentTimeMillis();
    Tag tag = new IntTag(SL_USERS, Convert.longToInt(numUsers));
    tagList.removeTag(SL_USERS);
    tagList.addTag(tag);
  }
View Full Code Here

    tagList.addTag(tag);
  }

  void setNumFiles(long numFiles) {
    last_udp_response = System.currentTimeMillis();
    Tag tag = new IntTag(SL_FILES, Convert.longToInt(numFiles));
    tagList.removeTag(SL_FILES);
    tagList.addTag(tag);

  }
View Full Code Here

      if (indexer == null) indexer = new Index(targetID);
      SharedFile file = SharingManagerSingleton.getInstance().getSharedFile(fileHash);
      InternalJKadManager _jkad_manager = (InternalJKadManager) JKadManagerSingleton.getInstance();
      ConfigurationManager config_manager = ConfigurationManagerSingleton.getInstance();
      TagList tagList = new TagList();
      tagList.addTag(new IntTag(JKadConstants.TAG_SOURCEIP, Convert.byteToInt(_jkad_manager.getIPAddress().getAddress())));
      try {
        tagList.addTag(new ShortTag(JKadConstants.TAG_SOURCEPORT, Convert.intToShort(config_manager.getTCP())));
      } catch (ConfigurationManagerException e) {
        e.printStackTrace();
        _jkad_manager.disconnect();
      }
      try {
        tagList.addTag(new ShortTag(JKadConstants.TAG_SOURCEUPORT, Convert.intToShort(config_manager.getUDP())));
      } catch (ConfigurationManagerException e) {
        e.printStackTrace();
        _jkad_manager.disconnect();
      }
      tagList.addTag(new IntTag(JKadConstants.TAG_FILESIZE, Convert.longToInt(file.length())));
      Source my_source = new Source(_jkad_manager.getClientID(), tagList);
     
      indexer.addSource(my_source);
    }
   
View Full Code Here

 
  public Source(ClientID clientID, IPAddress address, int udpPort, int tcpPort) {
    creationTime = System.currentTimeMillis();
    this.clientID = clientID;
    tagList = new TagList();
    tagList.addTag(new IntTag(JKadConstants.TAG_SOURCEIP,Convert.byteToInt(address.getAddress())));
    tagList.addTag(new ShortTag(JKadConstants.TAG_SOURCEPORT,Convert.intToShort(tcpPort)));
    tagList.addTag(new ShortTag(JKadConstants.TAG_SOURCEUPORT,Convert.intToShort(udpPort)));
  }
View Full Code Here

    return new IPAddress(Convert.intToByteArray(value));
  }

  public void setAddress(IPAddress address) {
    tagList.removeTag(JKadConstants.TAG_SOURCEIP);
    tagList.addTag(new IntTag(JKadConstants.TAG_SOURCEIP,Convert.byteToInt(address.getAddress())));
  }
View Full Code Here

    try {
      TagList tagList = new TagList();
      Tag tag;
      tag = new StringTag(FT_FILENAME, fileLink.getFileName());
      tagList.addTag(tag);
      tag = new IntTag(FT_FILESIZE, Convert.longToInt((fileLink
          .getFileSize())));
      tagList.addTag(tag);
      createDownloadFiles(fileLink.getFileName(), fileLink.getFileSize(),
          fileLink.getFileHash(), null, tagList);
      int partCount = (int) ((sharedFile.length() / PARTSIZE));
View Full Code Here

  public static Packet getServerLoginPacket(UserHash userHash, int clientPort,
      String userNickName) throws JMException {
   
    TagList tagList = new TagList();
    tagList.addTag(new StringTag(TAG_NAME_NAME, userNickName));
    tagList.addTag(new IntTag(TAG_NAME_PROTOCOLVERSION,ProtocolVersion ));
    tagList.addTag(new IntTag(TAG_NAME_CLIENTVER, ServerSoftwareVersion));
    tagList.addTag(new IntTag(TAG_NAME_FLAGS, SUPPORTED_FLAGS));
    tagList.addTag(new IntTag(TAG_NAME_UDP_PORT, ConfigurationManagerSingleton.getInstance().getUDP()));
 
    int tag_list_size = tagList.getByteSize();
   
    Packet packet = new Packet(16 + 4 + 2 + 4 + tag_list_size, PROTO_EDONKEY_TCP);
    packet.setCommand(OP_LOGINREQUEST);//Insert LOGIN_COMMAND
View Full Code Here

TOP

Related Classes of org.jmule.core.edonkey.packet.tag.IntTag

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.