Package com.example.client
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 TypeMethodDescriptionboolean
Logs in the client with the specified nickname.void
Logs out the client from the chat application and stops its operation.void
sendMessage
(String message) Sends a message from the client to the chat application server.void
start()
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
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
Logs out the client from the chat application and stops its operation.- Throws:
IOException
- if an error occurs during the logout process
-
sendMessage
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.
-