Package ej.rcommand.serversocket
Class RemoteCommandServer
- java.lang.Object
-
- ej.rcommand.serversocket.RemoteCommandServer
-
- All Implemented Interfaces:
ConnectivityManager,Runnable
public class RemoteCommandServer extends Object implements Runnable, ConnectivityManager
Server which client administration connect to.
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectivityListener(ConnectivityListener listener)Adds a listener.intgetAvailable()Returns the numbers of available connections.StringgetConnectionInfo()Returns a String representing how the service can be joined from remote clients.voidremoveConnectivityListener(ConnectivityListener listener)Removes a listener.voidrun()When an object implementing interfaceRunnableis used to create a thread, starting the thread causes the object'srunmethod to be called in that separately executing thread.voidstopRunning()
-
-
-
Constructor Detail
-
RemoteCommandServer
public 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.- Parameters:
commandManager- the command manager.port- the port where the server listen.nbMaxConnection- the maximum number of simultaneous connection.
-
-
Method Detail
-
run
public void run()
Description copied from interface:RunnableWhen an object implementing interfaceRunnableis used to create a thread, starting the thread causes the object'srunmethod to be called in that separately executing thread.The general contract of the method
runis that it may take any action whatsoever.- Specified by:
runin interfaceRunnable- See Also:
Thread.run()
-
stopRunning
public void stopRunning() throws IOException- Throws:
IOException
-
getAvailable
public int getAvailable()
Description copied from interface:ConnectivityManagerReturns the numbers of available connections.- Specified by:
getAvailablein interfaceConnectivityManager- Returns:
- the numbers of available connections.
-
getConnectionInfo
public String getConnectionInfo()
Description copied from interface:ConnectivityManagerReturns a String representing how the service can be joined from remote clients.Examples of such strings are:
192.168.0.1:4000for 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=115200for a service listening on a COMM port with these parameters
- Specified by:
getConnectionInfoin interfaceConnectivityManager- Returns:
- the connectivity URL, as a String.
-
addConnectivityListener
public void addConnectivityListener(ConnectivityListener listener)
Description copied from interface:ConnectivityManagerAdds a listener.- Specified by:
addConnectivityListenerin interfaceConnectivityManager- Parameters:
listener- the listener.
-
removeConnectivityListener
public void removeConnectivityListener(ConnectivityListener listener)
Description copied from interface:ConnectivityManagerRemoves a listener.- Specified by:
removeConnectivityListenerin interfaceConnectivityManager- Parameters:
listener- the listener.
-
-