Class ServerThread

All Implemented Interfaces:
Runnable

public class ServerThread extends Thread
ServerThread is a class that extends the Thread class and is used to manage the petitions received from the clients in different threads.
  • Method Details

    • run

      public void run()
      Starts the thread.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • processPetition

      public void processPetition()
      Processes the petition received from the client.
    • ListPetition

      public static void ListPetition(String petition, OutputStream out, InputStream in, String[] petitionTokens)
      Lists the files in the server directory requested by the client.
      Parameters:
      petition - The petition received from the client.
      out - The output stream to send data to the client.
      in - The input stream to receive data from the client.
      petitionTokens - The tokens of the petition received from the client.
    • SendPetition

      public static void SendPetition(String petition, OutputStream out, InputStream in, String[] petitionTokens)
      Sends a file to the client.
      Parameters:
      petition - The petition received from the client.
      out - The output stream to send data to the client.
      in - The input stream to receive data from the client.
      petitionTokens - The tokens of the petition received from the client.
    • ReceivePetition

      public static void ReceivePetition(String petition, OutputStream out, InputStream in, String[] petitionTokens)
      Receives a file from the client and saves it in the server.
      Parameters:
      petition - The petition received from the client.
      out - The output stream to send data to the client.
      in - The input stream to receive data from the client.
      petitionTokens - The tokens of the petition received from the client.
    • ExecPetition

      public static void ExecPetition(String petition, OutputStream out, InputStream in, String[] petitionTokens)
      Executes a command in the server.
      Parameters:
      petition - The petition received from the client.
      out - The output stream to send data to the client.
      in - The input stream to receive data from the client.
      petitionTokens - The tokens of the petition received from the client.
    • ExitPetition

      public static void ExitPetition()
      Closes the connection with the client.