Package org.medcare.igtl.network
Class OpenIGTServer
java.lang.Object
org.medcare.igtl.network.OpenIGTServer
- Direct Known Subclasses:
GenericIGTLinkServer
The class can be used to create a server listening a port Messages received will be queued and proceed
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionOpenIGTServer
(int port, ErrorManager errorManager) Default MessageQueueManager constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
abstract MessageHandler
getMessageHandler
(Header header, byte[] bodyBuf, ServerThread serverThread) ** To get message Handlerboolean
void
sendMessage
(OpenIGTMessage message) Sends a message up the linkvoid
setCurrentStatus
(OpenIGTServer.ServerStatus currentStatus) void
setKeepAlive
(boolean keepAlive) void
setServerThread
(ServerThread thread) void
startListening
(int port) void
startServer
(int port) void
-
Field Details
-
errorManager
-
-
Constructor Details
-
OpenIGTServer
Default MessageQueueManager constructor.- Parameters:
port
- port on which this server will be binderrorManager
- main class running this server- Throws:
Exception
-
-
Method Details
-
startServer
- Throws:
IOException
-
startListening
public void startListening(int port) -
stopServer
public void stopServer() -
sendMessage
Sends a message up the link- Throws:
Exception
-
getMessageHandler
public abstract MessageHandler getMessageHandler(Header header, byte[] bodyBuf, ServerThread serverThread) ** To get message Handler- Parameters:
header
- header of the message receivedbodyBuf
- byte array of the body of the message receivedserverThread
- serverThread managing connection of client where does come from the message **- Returns:
- the message Handler
-
setServerThread
-
getServerThread
-
getKeepAlive
public boolean getKeepAlive()- Returns:
- the killAlive
-
setKeepAlive
public void setKeepAlive(boolean keepAlive) -
getCurrentStatus
- Returns:
- the currentStatus
-
setCurrentStatus
- Parameters:
currentStatus
- the currentStatus to set
-
isConnected
public boolean isConnected()
-