Class ClientRxHandler
- java.lang.Object
-
- java.lang.Thread
-
- jmri.jmrix.loconet.loconetovertcp.ClientRxHandler
-
- All Implemented Interfaces:
java.lang.Runnable
,java.util.EventListener
,LocoNetListener
public final class ClientRxHandler extends java.lang.Thread implements LocoNetListener
Implementation of the LocoNetOverTcp LbServer Server Protocol.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ClientRxHandler.ClientTxHandler
-
Field Summary
Fields Modifier and Type Field Description (package private) java.net.Socket
clientSocket
(package private) java.io.BufferedReader
inStream
(package private) java.lang.String
inString
(package private) LocoNetMessage
lastSentMessage
(package private) java.util.LinkedList<LocoNetMessage>
msgQueue
(package private) java.io.OutputStream
outStream
(package private) java.lang.String
remoteAddress
(package private) LnTrafficController
tc
(package private) java.lang.Thread
txThread
-
Constructor Summary
Constructors Constructor Description ClientRxHandler(java.lang.String newRemoteAddress, java.net.Socket newSocket, LnTrafficController _tc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
(package private) void
dispose()
Kill this thread, usually for testing purposesvoid
message(LocoNetMessage msg)
Member function that will be invoked by a LocoNetInterface implementation to forward a LocoNet message from the layout.void
run()
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
clientSocket
java.net.Socket clientSocket
-
inStream
java.io.BufferedReader inStream
-
outStream
java.io.OutputStream outStream
-
msgQueue
final java.util.LinkedList<LocoNetMessage> msgQueue
-
txThread
volatile java.lang.Thread txThread
-
inString
java.lang.String inString
-
remoteAddress
java.lang.String remoteAddress
-
lastSentMessage
LocoNetMessage lastSentMessage
-
-
Constructor Detail
-
ClientRxHandler
public ClientRxHandler(java.lang.String newRemoteAddress, java.net.Socket newSocket, LnTrafficController _tc)
-
-
Method Detail
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
close
public void close()
-
message
public void message(LocoNetMessage msg)
Description copied from interface:LocoNetListener
Member function that will be invoked by a LocoNetInterface implementation to forward a LocoNet message from the layout.- Specified by:
message
in interfaceLocoNetListener
- Parameters:
msg
- The received LocoNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
dispose
void dispose()
Kill this thread, usually for testing purposes
-
-