Package org.medcare.igtl.network
Class OpenIGTClient
java.lang.Object
java.lang.Thread
org.medcare.igtl.network.OpenIGTClient
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
GenericIGTLinkClient
The class can be used by first connecting to a server sending requests comming from the requestQueue, listening for response and adding response to the responsqueue
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionOpenIGTClient(String host, int port, ErrorManager errorManager) Default OpenIGTClient constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract ResponseHandlergetResponseHandler(Header header, byte[] bodyBuf) ** To get response Handler** To set server status **voidInterrupt this threadbooleanvoidrun()Reader thread.final booleansendBytes(byte[] bytes) Sends bytesvoidsendMessage(OpenIGTMessage message) voidsendMessage(Header header, byte[] body) voidsetSocketFactory(SocketFactory socketFactory) void** To set server statusMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
errorManager
-
-
Constructor Details
-
OpenIGTClient
public OpenIGTClient(String host, int port, ErrorManager errorManager) throws UnknownHostException, IOException Default OpenIGTClient constructor.- Parameters:
host- to be connectedport- of the hosterrorManager- main class running this client- Throws:
IOExceptionUnknownHostException
-
-
Method Details
-
run
public void run()Reader thread. Reads messages from the socket and add them to the ResponseQueueManager -
setSocketFactory
-
sendMessage
- Throws:
Exception
-
sendMessage
- Throws:
Exception
-
sendBytes
Sends bytes- Parameters:
bytes- - byte[] array.- Throws:
IOException- - Exception in I/O.
-
interrupt
public void interrupt()Interrupt this thread -
getStatus
** To set server status **- Returns:
- the status status
-
setStatus
** To set server status- Parameters:
status- **
-
getResponseHandler
** To get response Handler- Parameters:
header- header of the message receivedbodyBuf- byte array of the body of the message received **- Returns:
- the response Handler
-
isConnected
public boolean isConnected()
-