So, i am creating a FTP server, that works with a SERVER.java and Client.java..
When a client connects to the server, the server first reads a one-line command from the client.
The command can be:
• The string "LIST". In this case, the server responds by sending a list of names of all the
files that are available on the server.
• Or the command can be of the form "GET <filename>", where <filename> is a file name.
o The server checks whether the requested file exists.
o If so, it sends "OK" as a message to the client. Then it sends the contents of the
file and closes the connection.
o Otherwise, it sends a line beginning with the word "ERROR" to the client.
• The server can also respond with the message "unknown command" if the command it
reads is not one of the two possible legal commands,
For all the three cases, the server must return a thread ID (worker ID) to the client.
Your program should use a thread class to handle each request that the server receives. It should
not stop after handling one request; it should remain open and continue to accept new requests.
I am done with all this cases, but when I am typing GET Command in terminal my terminal get stucks...
This is the SERVER.java output
PS D:\Assignmensts\assignment 2> java -jar Server.jar
Server is listening on port 7210
Received command: LIST
Sent LIST response
Received command: LIST
Sent LIST response
Received command: GET test.txt
Sent OK response for file: test.txt
and This is the output of client.java
PS D:\Assignmensts\assignment 2> java Client 127.0.0.1 7210
Connecting to server 127.0.0.1:7210
---Connection Successful---
Received Worker ID: 21
Enter command (type 'exit' to close connection): LIST
Sending "LIST" to server
Server response:
test.txt
Enter command (type 'exit' to close connection): LIST
Sending "LIST" to server
Server response:
test.txt
Enter command (type 'exit' to close connection): GET test.txt
Sending "GET test.txt" to server
File "test.txt" already exists. Do you want to overwrite it? (yes/no): yes
Here, after the File "test.txt" already exists. Do you want to overwrite it? (yes/no): yes line my terminal get stucks but the expected output is Download Successful...
i dont know, what part of my code is giving the issue, kindly help me please i request i am trying to fix from 4-5 hours... waiting for the response.
