Interface Client

All Known Implementing Classes:
BaseClient

public interface Client
The Client interface defines methods for managing a client in the chat application.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    login(String nickname)
    Logs in the client with the specified nickname.
    void
    Logs out the client from the chat application and stops its operation.
    void
    Sends a message from the client to the chat application server.
    void
    Starts the client, facilitating communication in the chat application.
    void
    Starts the listener for incoming messages from the chat application server.
  • Method Details

    • start

      void start()
      Starts the client, facilitating communication in the chat application.
    • login

      boolean login(String nickname) throws IOException
      Logs in the client with the specified nickname.
      Parameters:
      nickname - the nickname of the client
      Returns:
      true if the login is successful, false otherwise
      Throws:
      IOException - if an error occurs during the login process
    • logoutAndStop

      void logoutAndStop() throws IOException
      Logs out the client from the chat application and stops its operation.
      Throws:
      IOException - if an error occurs during the logout process
    • sendMessage

      void sendMessage(String message) throws IOException
      Sends a message from the client to the chat application server.
      Parameters:
      message - the message to send
      Throws:
      IOException - if an error occurs during message sending
    • startListener

      void startListener()
      Starts the listener for incoming messages from the chat application server.