org.klomp.snark
Class PeerConnectionOut

java.lang.Object
  extended by org.klomp.snark.PeerConnectionOut
All Implemented Interfaces:
java.lang.Runnable

 class PeerConnectionOut
extends java.lang.Object
implements java.lang.Runnable


Field Summary
(package private)  long lastSent
           
 
Constructor Summary
PeerConnectionOut(Peer peer, java.io.DataOutputStream dout)
           
 
Method Summary
(package private)  void cancelRequest(int piece, int begin, int length)
           
 void disconnect()
           
(package private)  int queuedBytes()
           
(package private)  void retransmitRequests(java.util.List requests)
           
 void run()
          Continuesly monitors for more outgoing messages that have to be send.
(package private)  void sendAlive()
           
(package private)  void sendBitfield(BitField bitfield)
           
(package private)  void sendCancel(Request req)
           
(package private)  void sendChoke(boolean choke)
           
(package private)  void sendHave(int piece)
           
(package private)  void sendInterest(boolean interest)
           
(package private)  void sendPiece(int piece, int begin, int length, byte[] bytes)
           
(package private)  void sendRequest(Request req)
           
(package private)  void sendRequests(java.util.List requests)
           
 void startup()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastSent

long lastSent
Constructor Detail

PeerConnectionOut

public PeerConnectionOut(Peer peer,
                         java.io.DataOutputStream dout)
Method Detail

startup

public void startup()

run

public void run()
Continuesly monitors for more outgoing messages that have to be send. Stops if quit is true of an IOException occurs.

Specified by:
run in interface java.lang.Runnable

disconnect

public void disconnect()

sendAlive

void sendAlive()

sendChoke

void sendChoke(boolean choke)

sendInterest

void sendInterest(boolean interest)

sendHave

void sendHave(int piece)

sendBitfield

void sendBitfield(BitField bitfield)

retransmitRequests

void retransmitRequests(java.util.List requests)

sendRequests

void sendRequests(java.util.List requests)

sendRequest

void sendRequest(Request req)

queuedBytes

int queuedBytes()

sendPiece

void sendPiece(int piece,
               int begin,
               int length,
               byte[] bytes)

sendCancel

void sendCancel(Request req)

cancelRequest

void cancelRequest(int piece,
                   int begin,
                   int length)