client.JFilesClient - rsanchez-wsu/jfiles GitHub Wiki
This is the main class of the JFiles client application
Package: client
Config:
- 'serverName' - Default value "localhost"
- 'serverPort' - Default value "9786"
Constructors
+ JFilesClient(String serverName, int serverPort)
Parameters:
- 'serverName' - The name of the server that the client will connect to.
- 'serverPort' - The port number on the server that the client will connect to.
Member Variables
-
'static final Logger logger' - LogManager.getLogger(JfilesClient.class). Private:
-
'Socket socket' - Default value NULL.
-
'Thread thread' - Default value NULL.
-
'DataInputStream console' - Default value NULL.
-
'DataOutputStream streamOut' - Default value NULL.
-
'JFilesClientThread client' - Default value NULL.
-
'static String host' - Default value "localhost"
-
'static int port' - Default value 9786
Functions
+ private static void setupConfig() throws IOException
Handles allocating resources needed for the server. @throws - IOException if there is a problem binding to the socket.
+ public void run()
While thread is true connect to server.
+ public void sendCommand(Command cmd)
Parameters:
- 'cmd' - command to be sent tot he server.
Sends the given command('cmd') to the server.
+ public void handle(String msg)
Parameters:
- 'msg' - message to be output to the console.
This method handles a message('msg').
+ public void start() throws IOException
Starts the client's connection to the server.
+ public void stop()
Stops the thread
+ public void main(String[] args)
Creates an a new JFilesClient object.