public class RemoteCommandServer extends Object implements Runnable, ConnectivityManager
Constructor and Description |
---|
RemoteCommandServer(RemoteCommandManager commandManager,
int port,
int nbMaxConnection)
Creates a server which listen to the given port and accepts at maximum
the given number of connections.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnectivityListener(ConnectivityListener listener)
Adds a listener.
|
int |
getAvailable()
Returns the numbers of available connections.
|
String |
getConnectionInfo()
Returns a String representing how the service can be joined from remote
clients.
|
void |
removeConnectivityListener(ConnectivityListener listener)
Removes a listener.
|
void |
run()
When an object implementing interface
Runnable is used to create a thread, starting
the thread causes the object's run method to be called in that separately executing
thread. |
void |
stopRunning() |
public RemoteCommandServer(RemoteCommandManager commandManager, int port, int nbMaxConnection)
commandManager
- the command manager.port
- the port where the server listen.nbMaxConnection
- the maximum number of simultaneous connection.public void addConnectivityListener(ConnectivityListener listener)
ConnectivityManager
addConnectivityListener
in interface ConnectivityManager
listener
- the listener.public int getAvailable()
ConnectivityManager
getAvailable
in interface ConnectivityManager
public String getConnectionInfo()
ConnectivityManager
Examples of such strings are:
192.168.0.1:4000
for a service listening on a TCP port
on these addresses and ports.
for a service listening on a TCP port on these
addresses and ports.
comm:com6;baudrate=115200
for a service listening on a
COMM port with these parameters
getConnectionInfo
in interface ConnectivityManager
public void removeConnectivityListener(ConnectivityListener listener)
ConnectivityManager
removeConnectivityListener
in interface ConnectivityManager
listener
- the listener.public void run()
Runnable
Runnable
is used to create a thread, starting
the thread causes the object's run
method to be called in that separately executing
thread.
The general contract of the method run
is that it may take any action whatsoever.
run
in interface Runnable
Thread.run()
public void stopRunning() throws IOException
IOException