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)
ConnectivityManageraddConnectivityListener in interface ConnectivityManagerlistener - the listener.public int getAvailable()
ConnectivityManagergetAvailable in interface ConnectivityManagerpublic String getConnectionInfo()
ConnectivityManagerExamples 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 ConnectivityManagerpublic void removeConnectivityListener(ConnectivityListener listener)
ConnectivityManagerremoveConnectivityListener in interface ConnectivityManagerlistener - the listener.public void run()
RunnableRunnable 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 RunnableThread.run()public void stopRunning()
throws IOException
IOException