|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmil.navy.nps.dis.BehaviorStreamBuffer
mil.navy.nps.dis.BehaviorStreamBufferTCP
BehaviorStreamBufferTCP is a class responsible for interpreting data received via a TCP socket and interpreting it as DIS PDUs.
DIS is by nature packet-oriented, while TCP is stream-oriented. this means that we must parse the data as it comes in, to determine how many bytes to read. This can be done via the PDU length field in the PDU header. This is always at the same point in the packet, and describes how many bytes to read. By nature, if this count is off, the stream will get scrambled.
Field Summary | |
static boolean |
DEBUG
|
static int |
MAX_DATAGRAM_SIZE
|
protected SecurityStrategy |
strategy
SecurityStrategy is used as a way to get around the java sandbox. |
Fields inherited from class mil.navy.nps.dis.BehaviorStreamBuffer |
info, inputThreadStarted, readThreadRunning, rtpEnabled, runContinue |
Constructor Summary | |
BehaviorStreamBufferTCP(java.net.Socket pSocket)
Constructor, takes a connected socket. |
|
BehaviorStreamBufferTCP(java.lang.String pAddress,
int port)
Constructor; takes a string inet address and a port number. |
Method Summary | |
void |
cleanup()
Closes down input buffers, sockets, or open files nicely |
void |
debug(java.lang.String pMessage)
Debugging output |
protected void |
finalize()
Finalize method--used to clean up any sockets that are still open |
ProtocolDataUnit |
getNextPdu()
Get the next PDU from the input stream. |
java.util.Vector |
receivedPdus()
Returns a vector of all the PDUs received since the last time we asked. |
void |
resumeReading()
Start reading packets from the datagramStreamBuffer again. |
void |
run()
Threading method to read/write until shutdown. |
void |
sendPdu(ProtocolDataUnit pPdu)
Sends a PDU. |
void |
sendPdu(ProtocolDataUnit pPdu,
java.lang.Object pAddress1,
java.lang.Object pAddress2)
Send a PDU to an address. |
void |
shutdown()
Terminate the run loop and shutdown the thread. |
void |
startInputThread()
Simple method to launch thread. |
void |
suspendReading()
suspend reading in the DatagramStreamBuffer |
void |
trace(java.lang.String pMessage)
tracing output |
Methods inherited from class mil.navy.nps.dis.BehaviorStreamBuffer |
checkForThreadStart, getDEBUG, getInfo, getRtpEnabled, sendPdu, setDEBUG, setInfo, setRtpEnabled, startInputThreadWithSecurity |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAX_DATAGRAM_SIZE
public static boolean DEBUG
protected SecurityStrategy strategy
Constructor Detail |
public BehaviorStreamBufferTCP(java.net.Socket pSocket)
public BehaviorStreamBufferTCP(java.lang.String pAddress, int port)
Method Detail |
public void startInputThread()
startInputThread
in class BehaviorStreamBuffer
public void shutdown()
shutdown
in class BehaviorStreamBuffer
public void suspendReading()
suspendReading
in class BehaviorStreamBuffer
public void resumeReading()
resumeReading
in class BehaviorStreamBuffer
public void run()
run
in interface java.lang.Runnable
run
in class BehaviorStreamBuffer
public java.util.Vector receivedPdus()
receivedPdus
in class BehaviorStreamBuffer
public ProtocolDataUnit getNextPdu()
getNextPdu
in class BehaviorStreamBuffer
public void sendPdu(ProtocolDataUnit pPdu)
sendPdu
in class BehaviorStreamBuffer
public void sendPdu(ProtocolDataUnit pPdu, java.lang.Object pAddress1, java.lang.Object pAddress2)
Note that if you're sending to the "standard" tcp destination address, you should use sendPdu().
sendPdu
in class BehaviorStreamBuffer
pPdu
- protocol data unit being sentpAddress1
- TCP address of destinationpAddress2
- port of destinationpublic void cleanup()
cleanup
in class BehaviorStreamBuffer
protected void finalize() throws java.lang.Throwable
finalize
in class BehaviorStreamBuffer
java.lang.Throwable
public void trace(java.lang.String pMessage)
trace
in class BehaviorStreamBuffer
public void debug(java.lang.String pMessage)
debug
in class BehaviorStreamBuffer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |