Class PeerInfo
java.lang.Object
com.frostwire.jlibtorrent.PeerInfo
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe kind of connection this is. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected PeerInfo.ConnectionTypeprotected intprotected intprotected Stringprotected floatprotected intprotected byteprotected longprotected longprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclient()This describes the software at the other end of the connection.The kind of connection this peer uses.intThe current download speed we have to and from this peer (including any protocol messages).intflags()Tells you in which state the peer is in.protected voidNOTE: use this with care and only if necessary.ip()The IP-address to this peer.floatprogress()The progress of the peer in the range [0, 1].intIndicates the download progress of the peer in the range [0, 1000000] (parts per million).bytesource()A combination of flags describing from which sources this peer was received.longThe total number of bytes downloaded from this peer.longThe total number of bytes uploaded to this peer.intupSpeed()The current upload speed we have to and from this peer (including any protocol messages).
-
Field Details
-
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
-
progress
protected float progress -
progressPpm
protected int progressPpm -
ip
-
-
Constructor Details
-
PeerInfo
-
-
Method Details
-
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
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
-
init
NOTE: use this with care and only if necessary.- Parameters:
p- the native object
-