Launch command for server:
java -jar Server.jar localhost 7777 20000Parameters: [Port] [Dalay] Port: The port for the server. Delay: Inactive time allowed. Session will be closed automatically after this delay.
Launch command for client:
java -jar Client.jar localhost 7777 7778Parameters: [Address] [Port] [Port 2] Address: The address for the server. Port: The port for the server. Port 2: Another port for launching an internal server for private connection.
Enter the usernameWhen running the client, a username will be required. The username is unique and is used to identify different users. If the username is duplicated, the result is displayed as follows:
If the username has not been confirmed by the server, the user can only enter the username and will not be able to receive or send messages and queries. Once the server has confirmed that the username is available, the user can start to try all the functions and receive the information and queries automatically.
Here are two types of requests that the user can receive:
1. receive a public messageIf the user logs in correctly, the public message will be printed immediately upon receipt, like below:
2. Private connection requestIf other users send you a request for a private connection, you will receive a reminder as follows:
You can only use y and n to process the request. The other input character is invalid. During the processing of the request, the user will always receive the message and the request, but the request will not be displayed immediately. Before displaying the next private connection invitation, it will wait for the user to process the current invitation, which means only one invitation will be displayed at the same time.
Here are 3 types of requests that the user can send:
1. Send a public messageThe public message is encoded in utf-8 and is sent automatically by pressing Enter, but the message can not begin with a - or @ character (which conflicts with other functions).
2. System commandsThe system commands start with -. This client now supports 7 instructions:
-list Request a list of all username online. -quit Log out and leave -connect [username] Request a private connection to [USERNAME]. -disconnect [username] Cut down the private connection of [USERNAME]. -private Ask for a username list that you have connected to in privately. -path [path] Files received from other users will be saved in [PATH] -help View all features and explanations
3. Create a private connectionThe user must first use -connect to send a private connection request to the server. Once the private connection is successful, the user can send a private message or transfer the file. The code to send the private information is:
@ [USERNAME] [MESSAGE]
The code to send files is:
@ [USERNAME] -send [PATH_TO_FILE]