Server contact StepThrough - rsanchez-wsu/jfiles GitHub Wiki

##run()

  1. Once the server is set up, the server control thread(thread 2) will be watching in the run() methods for contacts when it does it will contact the addThread() method.
  2. Once a thread to handle the client is added, cycle around to listen for more clients.

##addThread()

  1. Check if there is room in clients array for a new client, if not print to console that the connection was refused. Do NOT close the connection or do anything to inform the client. (Issue 249)
  2. Create a new JfilesServerThread Object passing it the server object and the socket for the client.
  3. Run the open() method for the new JfilesServerThread object.
  4. Run the start() method for the new JfilesServerThread object. This is method iherited from the Thread class that will start the thread on JfilesServerThread's run() command.

JfilesServerThread Creation method()

  1. JfilesServerThread extends Thread. RU nthe creation method for thread().
  2. Store the passed server object and the socket of the client.
  3. Get the Id of the client socket and store it in id.

##open()

  1. Get the input and output streams for the socket.

##JfilesServerThread run()

  1. Start listening for incoming data. This data is read using the readUTF() method then handled by the servers handle() method. The readUTF() method is not the same as the readline() method which can make communicating with telnot or netcat complicated.