assignment, part 2 - montefiore institute · thread 2 thread 4 thread pool 1. handle the first 5...
TRANSCRIPT
![Page 1: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/1.jpg)
Assignment, part 2Statement and concepts
INFO-0010
![Page 2: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/2.jpg)
Objectives
1. Learn on your own the details of the FTP protocol2. Implement a FTP server
img src : https://www.unixmen.com/install-configure-ftp-server-centos-7/
![Page 3: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/3.jpg)
Outline
Implementation of concepts
Statement
![Page 4: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/4.jpg)
Learning FTP
Self-learning is one of the objectives of the assignment
Helpful resources :
These slides
RFC 959
Free-to-use FTP server : ftp://speedtest.tele2.net
![Page 5: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/5.jpg)
The FTP protocol
Application protocol over TCP.
Transfer files between machines
Mostly text-oriented protocol
Separate control and data channel
![Page 6: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/6.jpg)
FTP requests
FTP request = String of text, starting with a method in upper-case, ending with CRLF
Some requests take extra parameters, others are only the method + CRLF
Example of valid requests : CWD<CRLF>
RETR File.zip<CRLF>
Operations may span over several requests (e.g. USER PASS)
Operations may also use both control and data connection(e.g. RETR or STOR)
![Page 7: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/7.jpg)
FTP response codes
The first digit of the response code indicates successor failure:
1xx : Positive preliminary reply
2xx : Positive completion reply
3xx : Positive intermediary reply
4xx : Transient negative completion reply
5xx : Permanent negative completion reply
![Page 8: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/8.jpg)
FTP response codes (cont’d)
The second digit of the response code classifies the category of the response:
x0x : Syntax
x1x : Information
x2x : Connections
x3x : Authentication and accounting
x4x : Not defined
x5x : File system
![Page 9: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/9.jpg)
FTP response codes (cont’d)
FTP uses a few dozens of codes, and considering all of them is outside the scope of this assignment.
It’s up to you to find out which requests/responsecodes are mandatory given your objective.
A complete list of requests/responses codes can befound on the internet.
![Page 10: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/10.jpg)
Data connection establishment (active mode)
![Page 11: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/11.jpg)
The problem of active mode
PORT 139,165,8,41,154,208
139.165.8.41 139.165.8.13
(port 2101)
(port 2001)(port 39632)
SYN
![Page 12: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/12.jpg)
Data connection establishment (passive mode)
![Page 13: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/13.jpg)
Binary vs ASCII
« TYPE I » : Binary mode
« TYPE A » : ASCII (text) mode
01110010010010111100100111001100110010
« Wow, human-readable characters, how nice »
![Page 14: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/14.jpg)
Directory navigation
CDUP: change to parent directory;
CWD: change working directory;
LIST: list the content of a given directory, or the current one if no parameter;
PWD: gives the path of the current directory.
![Page 15: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/15.jpg)
Thread pools
Previously:
server
Request 1 Thread 1
Request 2Thread 2
Request 3Thread 3
![Page 16: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/16.jpg)
Thread pools
Imagine the following attack:
Socket[] s = new Socket[10000];
for(int i = 0; i < 10000; i++)
{
s[i] = new Socket("100.100.100.100",80);
}
10,000 Requests
Thread 1
Thread 3
Thread 5
Thread 2
Thread 4
![Page 17: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/17.jpg)
Thread pools
With a thread pool:
server
Thread 1
10,000 RequestsThread 3
Thread 5
Thread 2
Thread 4
Thread pool
1. Handle the first 5 requests (9,995 remaining)2. As soon as a thread finishes, it returns to the pool and receives a new task3. When all tasks are done, each thread is back in the pool, ready for new tasks
Possible loss of speed performance, but increased robustness
![Page 18: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/18.jpg)
Outline
Implementation of concepts
Statement
![Page 19: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/19.jpg)
Mandatory features
Work with Filezilla (installed on ms8** machines)
Download/Upload file
Rename file
Delete file
Navigate through the directory
List the content of current directory
Don’t handle creation/renaming/deletion of folders
![Page 20: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/20.jpg)
Directory content
Note : - All files are virtual, in the sense that they are only stored in memory, not on disk- « myimage.bmp » will be provided.
« UPUPDOWNDOWNLEFTRIGHTLEFTRIGHTBASTART »
« Irasshaimase »
![Page 21: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/21.jpg)
User authentication
Anonymous login must be possibleUser « Sam » with password « 123456 » is also allowed.
Anonymous users and Sam have the same rights, except that Sam can see and handle the « private » folder.Note: this differs from the usual FTP authentication which is more binary
![Page 22: Assignment, part 2 - Montefiore Institute · Thread 2 Thread 4 Thread pool 1. Handle the first 5 requests (9,995 remaining) 2. As soon as a thread finishes, it returns to the pool](https://reader033.vdocuments.mx/reader033/viewer/2022053011/5f0ed8fb7e708231d4413adc/html5/thumbnails/22.jpg)
Guidelines
Deadline : 15th of December.
Work by groups of two students.
Check that your program works on ms8** machines with Firefox (Don't have an account? Contact Marc Frédéric). Launch the server on a given machine, and try to access it from a differentmachine.
Guidelines of the first part still apply (Java 1.8, no package instructions, no file manipulation, don'tintercept CTRL-C, …).