|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTCPEntity
public class TCPEntity
A TCPEntity represents a TCP connection thread in the Transport layer. Each TCPEntity is associated with a specific socket on a specific host. It delegates packet handling to a reliable data transfer protocol.
When created, a TCPEntity is given a name. When setup, it is given a partner, which is the TCPEntity at the other end of the socket connection, and an RDTProtocol, which specifies the reliable data transfer protocol that it should use. In reality, of course, the partner TCPEntity would be replaced by just the host internet ID and port number of the partner.
A TCPEntity provides a context in which reliable data transfer protocol code can be executed in a single thread. It provides all necessary synchronization with other threads. It also, through its nested Context class, provides services that the reliable data transfer protocol can use to control the TCPEntity and to interface with the demultiplexer and reassembler on the receive side, and the segmenter and multiplexer on the send side.
Nested Class Summary | |
---|---|
class |
TCPEntity.Context
A Context is created by a TCPEntity and passed to its RDTProtocol during set up of the TCPEntity. |
Constructor Summary | |
---|---|
TCPEntity(java.lang.String nm)
new TCPEntity(nm) returns a new TCPEntity named nm. |
Method Summary | |
---|---|
void |
disconnect()
tcpe.disconnect() is invoked to get tcpe to disconnect from its communication partner. |
java.lang.String |
getReceivedMessage()
tcpe.getReceivedMessage() returns the message received by tcpe. |
void |
receivePacket(Packet pkt)
tcpe.receivePacket(pkt) is invoked to get tcpe to handle a packet from its connection partner. |
void |
run()
Do not invoke this method externally - it is automatically invoked at the end of the setUp() method. |
void |
sendData(int id)
tcpe.sendData(id) sends a new data packet with identification number id from tcpe to its communication partner. |
java.lang.Thread |
setUp(TCPEntity prtnr,
RDTProtocol proto)
tcpe.setUp(prtnr, proto) sets up tcpe for communication with prtnr using the reliable data transfer protocol proto. |
java.lang.String |
toString()
tcpe.toString() returns the name of tcpe. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TCPEntity(java.lang.String nm)
Method Detail |
---|
public java.lang.Thread setUp(TCPEntity prtnr, RDTProtocol proto)
public void sendData(int id)
This method is the segmenter's interface to the TCPEntity. It is invoked to schedule a segment for packetization and delivery. The id parameter is just a stand-in for the real data in a segment. It is used by the Logger for recording purposes.
public void receivePacket(Packet pkt)
This method is the demultiplexer's interface to the TCPEntity.
public java.lang.String getReceivedMessage()
public void disconnect()
public java.lang.String toString()
toString
in class java.lang.Object
public void run()
tcpe.run() repeatedly looks for tasks from the scheduler and executes them. This method is the top-level code executed by the protocol thread. When the method terminates, the thread terminates.
run
in interface java.lang.Runnable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |