public class CBRConnection extends Connection
bytesTransferred, fromInterface, fromNode, msgFromNode, msgOnFly, toInterface, toNode| Constructor and Description |
|---|
CBRConnection(DTNHost fromNode,
NetworkInterface fromInterface,
DTNHost toNode,
NetworkInterface toInterface,
int connectionSpeed)
Creates a new connection between nodes and sets the connection
state to "up".
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortTransfer()
Aborts the transfer of the currently transferred message.
|
int |
getRemainingByteCount()
Returns the amount of bytes to be transferred before ongoing transfer
is ready or 0 if there's no ongoing transfer or it has finished
already
|
double |
getSpeed()
returns the current speed of the connection
|
double |
getTransferDoneTime()
Gets the transferdonetime
|
boolean |
isMessageTransferred()
Returns true if the current message transfer is done.
|
int |
startTransfer(DTNHost from,
Message m)
Sets a message that this connection is currently transferring.
|
java.lang.String |
toString()
Returns a String presentation of the connection.
|
clearMsgOnFly, finalizeTransfer, getMessage, getOtherInterface, getOtherNode, getTotalBytesTransferred, isInitiator, isReadyForTransfer, isTransferring, isUp, setUpState, updatepublic CBRConnection(DTNHost fromNode, NetworkInterface fromInterface, DTNHost toNode, NetworkInterface toInterface, int connectionSpeed)
fromNode - The node that initiated the connectionfromInterface - The interface that initiated the connectiontoNode - The node in the other side of the connectiontoInterface - The interface in the other side of the connectionconnectionSpeed - Transfer speed of the connection (Bps) when
the connection is initiatedpublic int startTransfer(DTNHost from, Message m)
Connection.finalizeTransfer() and
isMessageTransferred() will not work either). Only a one message
at a time can be transferred using one connection.startTransfer in class Connectionfrom - The host sending the messagem - The messageMessageRouter.receiveMessage(Message, DTNHost)public void abortTransfer()
abortTransfer in class Connectionpublic double getTransferDoneTime()
public boolean isMessageTransferred()
isMessageTransferred in class Connectionpublic double getSpeed()
getSpeed in class Connectionpublic int getRemainingByteCount()
getRemainingByteCount in class Connectionpublic java.lang.String toString()
toString in class Connection