User Tools

Site Tools


tanszek:oktatas:integration_based_on_tcp_ip_sockets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tanszek:oktatas:integration_based_on_tcp_ip_sockets [2023/03/05 16:11] kneheztanszek:oktatas:integration_based_on_tcp_ip_sockets [2023/03/05 16:22] (current) knehez
Line 26: Line 26:
  
 [[Java example for Blocking and Non-Blocking Socket]] [[Java example for Blocking and Non-Blocking Socket]]
 +
 +** Exercise 1. **
 +
 +Create a simplified FTP (file transport) client and **blocking** server where the client can send or download text files from the server:
 +
 +== General use-cases ==
 +  -) Client connects to the server and sends a 'file listing' message
 +  -) Server sends back the list of the downloadable files
 +  -) Client lists the files and asks the user what action they want to take? Upload or download? ('u' or 'd'
 +  -) In both cases users must give the full file name with extension
 +  -) The client sends the selected file to the server (upload) or downloads the selected file from the server to a specific directory.
 +
 +
 +== Server viewpoint ==
 +  -) After connecting, it reads the files from the /store subdirectory and sends the file names to the client after receiving the listing message. 
 +  -) We are waiting for the client's 'u' or 'd' operation 
 +  -) We get a filename from the client and if the action is 'd' (download), we read the file content and return its contents
 +  -) If the operation is 'u' (upload), we open a new file with the specified name and wait for the data to be written to the file.
 +
 +== Client viewpoint ==
 +
 +  -) The client connects and waits for the list of files coming back and writes it to the console 
 +  -) We ask for the "u" or "d" key 
 +  -) Then we'll ask for the file-name as well. 
 +  -) The client reads the files from the /files folder, or creates the downloaded file here
 +  -) If you press "d", it creates /files/ and writes data from the server
 +  -) If you press "u", /files/ is sent to the server
 +
 +
 +** Exercise 2. ** 
 +Modify the **non-blocking** code so that you can transfer a burned-in name and existing text or image file larger than 2 kbytes and verify that it was successfully sent.
 +
  
tanszek/oktatas/integration_based_on_tcp_ip_sockets.1678032691.txt.gz · Last modified: 2023/03/05 16:11 by knehez