|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcore.Connection
public class Connection
A connection between two DTN nodes.
| Constructor Summary | |
|---|---|
Connection(DTNHost fromNode,
DTNHost toNode,
int connectionSpeed)
Creates a new connection between nodes and sets the connection state to "up". |
|
| Method Summary | |
|---|---|
void |
abortTransfer()
Aborts the transfer of the currently transferred message. |
void |
finalizeTransfer()
Finalizes the transfer of the currently transferred message. |
int |
getBytesTransferred()
Returns the amount of bytes this connection has transferred so far |
Message |
getMessage()
Gets the message that this connection is currently transferring. |
DTNHost |
getOtherNode(DTNHost node)
Returns the node in the other end of the connection |
int |
getRemainingByteCount()
Returns the amount of bytes to be transferred before ongoing transfer is ready or 0 if there's no ongoing transfer |
boolean |
isInitiator(DTNHost node)
Returns true if the given node is the initiator of the connection, false otherwise |
boolean |
isMessageTransferred()
Returns true if the current message transfer is done. |
boolean |
isReadyForTransfer()
Returns true if the connection is ready to transfer a message (connection is up and there is no message being transferred). |
boolean |
isUp()
Returns true if the connection is up |
void |
setUpState(boolean state)
Sets the state of the connection. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Connection(DTNHost fromNode,
DTNHost toNode,
int connectionSpeed)
fromNode - The node that initiated the connectiontoNode - The node in the other side of the connectionconnectionSpeed - Transfer speed of the connection (Bps)| Method Detail |
|---|
public boolean isUp()
public boolean isInitiator(DTNHost node)
node - The node to check
public void setUpState(boolean state)
state - True if the connection is up, false if not
public int startTransfer(DTNHost from,
Message m)
finalizeTransfer() and
isMessageTransferred() will not work either). Only a one message
at a time can be transferred using one connection.
m - The message
MessageRouter.receiveMessage(Message, DTNHost)public void abortTransfer()
public int getRemainingByteCount()
public void finalizeTransfer()
getMessage()).
public boolean isMessageTransferred()
public boolean isReadyForTransfer()
public Message getMessage()
public int getBytesTransferred()
public DTNHost getOtherNode(DTNHost node)
node - The node in this end of the connection
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||