Class PeerInfo

java.lang.Object
com.frostwire.jlibtorrent.PeerInfo

public class PeerInfo extends Object
Holds information and statistics about one peer that libtorrent is connected to.

This class is a lightweight version of the native peer_info, and only carries a subset of all the information. However, it's completely open for custom use or optimization to accommodate client necessities.

  • Field Details

    • client

      protected String client
    • totalDownload

      protected long totalDownload
    • totalUpload

      protected long totalUpload
    • flags

      protected int flags
    • source

      protected byte source
    • upSpeed

      protected int upSpeed
    • downSpeed

      protected int downSpeed
    • connectionType

      protected PeerInfo.ConnectionType connectionType
    • progress

      protected float progress
    • progressPpm

      protected int progressPpm
    • ip

      protected String ip
  • Constructor Details

  • Method Details

    • client

      public String client()
      This describes the software at the other end of the connection. In some cases this information is not available, then it will contain a string that may give away something about which software is running in the other end. In the case of a web seed, the server type and version will be a part of this string.
      Returns:
      the client string
    • totalDownload

      public long totalDownload()
      The total number of bytes downloaded from this peer. These numbers do not include the protocol chatter, but only the payload data.
      Returns:
      number of bytes downloaded
    • totalUpload

      public long totalUpload()
      The total number of bytes uploaded to this peer. These numbers do not include the protocol chatter, but only the payload data.
      Returns:
      number of bytes uploaded
    • flags

      public int flags()
      Tells you in which state the peer is in. It is set to any combination of the peer_flags_t flags.
      Returns:
      the flags as an integer
    • source

      public byte source()
      A combination of flags describing from which sources this peer was received. A combination of the peer_source_flags_t flags.
      Returns:
      the flags as a byte
    • upSpeed

      public int upSpeed()
      The current upload speed we have to and from this peer (including any protocol messages). Updated about once per second
      Returns:
      current upload speed we have to and from this peer
    • downSpeed

      public int downSpeed()
      The current download speed we have to and from this peer (including any protocol messages). Updated about once per second
      Returns:
      current download speed we have to and from this peer
    • connectionType

      public PeerInfo.ConnectionType connectionType()
      The kind of connection this peer uses.
      Returns:
      the connection type
    • progress

      public float progress()
      The progress of the peer in the range [0, 1]. This is always 0 when floating point operations are disabled, instead use ``progress_ppm``.
      Returns:
      the progress of the peer in the range [0, 1]
    • progressPpm

      public int progressPpm()
      Indicates the download progress of the peer in the range [0, 1000000] (parts per million).
      Returns:
      the download progress of the peer in the range [0, 1000000]
    • ip

      public String ip()
      The IP-address to this peer.
      Returns:
      a string representing the endpoint.
    • init

      protected void init(peer_info p)
      NOTE: use this with care and only if necessary.
      Parameters:
      p - the native object