Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 1.25 KB

README.md

File metadata and controls

30 lines (24 loc) · 1.25 KB

File Sharing Protocol


Read Assignment2.pdf for problem statement
To run:
1) ./run.sh
2) ./server-client1
3) open new terminal and run ./server-client2

Both of the programs running act as server and client (used fork() --> one parent connected with other child and vice-versa).
One can upload a file in a shared folder
Other can search for a file and download that file
(TCP/UDP)
Basic index search and file upload is done. Other features can be inplemented by extending the code in similar fashion.

/* For FileUpload Algorithm

Client (gives filename as command, parse it):

(i) Send File name to Server in a variable using the function send()
(ii) take fp = (filename,read)
(iii) use fread to read the file
(iv) read small chunks and put them in a buffer (char variable)
(v) send those to server

Server:

(i) Make a newfile using fopen in write mode in shared folder and giving it file name that was being sent by client
(ii) write the file with the chunk of data being sent (in buffer variable)
(iii) Send an acknowledgement message to client regarding this