Class BitTorrent
- java.lang.Object
-
- org.johnnei.javatorrent.bittorrent.protocol.BitTorrent
-
public final class BitTorrent extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static CharsetDEFAULT_ENCODINGstatic intMESSAGE_BITFIELDUsed as a quick-have message.
Only allowed just after an handshake
Each bit represents the have state of a piece: 1 - have, 0 - not have.
Payload:
x times: ubyte - Bitfield data
(x will be Math.ceil(pieceCount / 8);)
The last byte will be padded with zero's so the message will be exactly x bytesstatic intMESSAGE_CANCELCancel a send piece request
payload:
uint index
uint offset
uint length
static intMESSAGE_CHOKEUsed to notify the peer that we choked them
No payloadstatic intMESSAGE_HAVENotify the peer that we have a piece
Payload:
1x: (u)int - Piece Indexstatic intMESSAGE_INTERESTEDUsed to notify the peer that we got interest in them
No payloadstatic intMESSAGE_PIECEThe data of a piece
Payload:
uint index - Piece Index
uint offset - Offset within the piece
x ubyte - The data, the length is equal the rest of the message bytesstatic intMESSAGE_PORTThis has something to do with DHT
payload:
listen-port
This is not yet implemented in this clientstatic intMESSAGE_REQUESTRequest a piece part from the peer
Payload:
uint index - Piece index
uint offset - Offset within the piece
uint length - The amount of data (Commenly 2^14/2^15), I use 2^14static intMESSAGE_UNCHOKEUsed to notify the peer that we unchoked them
No payloadstatic intMESSAGE_UNINTERESTEDUsed to notify the peer that we got no interest in them
No payload
-
-
-
Field Detail
-
DEFAULT_ENCODING
public static final Charset DEFAULT_ENCODING
-
MESSAGE_CHOKE
public static final int MESSAGE_CHOKE
Used to notify the peer that we choked them
No payload- See Also:
- Constant Field Values
-
MESSAGE_UNCHOKE
public static final int MESSAGE_UNCHOKE
Used to notify the peer that we unchoked them
No payload- See Also:
- Constant Field Values
-
MESSAGE_INTERESTED
public static final int MESSAGE_INTERESTED
Used to notify the peer that we got interest in them
No payload- See Also:
- Constant Field Values
-
MESSAGE_UNINTERESTED
public static final int MESSAGE_UNINTERESTED
Used to notify the peer that we got no interest in them
No payload- See Also:
- Constant Field Values
-
MESSAGE_HAVE
public static final int MESSAGE_HAVE
Notify the peer that we have a piece
Payload:
1x: (u)int - Piece Index- See Also:
- Constant Field Values
-
MESSAGE_BITFIELD
public static final int MESSAGE_BITFIELD
Used as a quick-have message.
Only allowed just after an handshake
Each bit represents the have state of a piece: 1 - have, 0 - not have.
Payload:
x times: ubyte - Bitfield data
(x will be Math.ceil(pieceCount / 8);)
The last byte will be padded with zero's so the message will be exactly x bytes- See Also:
- Constant Field Values
-
MESSAGE_REQUEST
public static final int MESSAGE_REQUEST
Request a piece part from the peer
Payload:
uint index - Piece index
uint offset - Offset within the piece
uint length - The amount of data (Commenly 2^14/2^15), I use 2^14- See Also:
- Constant Field Values
-
MESSAGE_PIECE
public static final int MESSAGE_PIECE
The data of a piece
Payload:
uint index - Piece Index
uint offset - Offset within the piece
x ubyte - The data, the length is equal the rest of the message bytes- See Also:
- Constant Field Values
-
MESSAGE_CANCEL
public static final int MESSAGE_CANCEL
Cancel a send piece request
payload:
uint index
uint offset
uint length
- See Also:
- Constant Field Values
-
MESSAGE_PORT
public static final int MESSAGE_PORT
This has something to do with DHT
payload:
listen-port
This is not yet implemented in this client- See Also:
- Constant Field Values
-
-