Passa al contenuto principale

Sequenza di comandi e risposte e scenari tipici

V.C Sequenza di comandi e risposte​

La comunicazione tra l'utente e il server è concepita come un dialogo alternato. In quanto tale, l'utente emette un comando FTP e il server risponde con una pronta risposta primaria. L'utente dovrebbe attendere questa iniziale risposta primaria di successo o di fallimento prima di inviare ulteriori comandi.

Un secondo tipo di risposta viene inviato in modo asincrono rispetto ai comandi dell'utente. Tali risposte possono ad esempio riferire sull'avanzamento o sul completamento del trasferimento del file e in quanto tali sono risposte secondarie ai comandi di trasferimento file.

La terza classe di risposte è costituita da risposte informative e spontanee che possono arrivare in qualsiasi momento. Tali risposte sono elencate di seguito come spontanee.

               COMMAND-REPLY CORRESPONDENCE TABLE

COMMAND SUCCESS FAIL

USER 230,330 430-432,500-505
PASS 230 430-432,500-505
BYE 231,232 430-432,500-505
BYTE 200 500-506
SOCK 200 500-506
TYPE 200 500-506
MODE 200 500-506
RETR 250 450,451,500-506
Secondary Reply 252 452
STOR 250 451,451,500-506
Secondary Reply 252 452,453
APPE 250 451,451,500-506
Secondary Reply 252 452,453
RNFR 200 450,451,500-506
RNTO 253 450,451,500-505
DELE 254 450,451,500-506
LIST 250 450,453,500-506
Secondary Reply 252 452
ALLO 200 500-506
STAT 100,150,151 450,451,500-506
REST 200 500-506
ABOR 201,202 500-505

Spontaneous 0xx,300,301 400,401,434-436
Replies 251,255

V.D. Scenari FTP tipici​

  1. Utente TIP che desidera trasferire un file dall'HOST X alla stampante locale:
a) TIP user opens TELNET connections by ICP to HOST X, socket 3.

b) The following commands and replies are exchanged:
TIP HOST X

USER username CRLF -------->
<------- 330 Enter Password CRLF

PASS password CRLF -------->
<------- 230 User logged in CRLF

SOCK 65538 CRLF -------->
<------- 200 Command received OK CRLF

RETR this.file CRLF -------->
<------- 255 SOCK 5533 CRLF

(HOST X initiates data connection to
TIP socket 65538, i.e., PORT 1 receive)

<------- 250 File transfer started

BYE CRLF ------_->
<------- 252 File transfer completed

c) HOST X closes the TELNET and data connections.

Note: The TIP user should be in line mode and can thus use
local TIP editing such as character delete.
  1. Utente sull'HOST U che desidera trasferire file verso/da HOST S:

In generale l'utente comunicherebbe con il server tramite un processo user-FTP intermediario. Il seguente può essere uno scenario tipico. I prompt dello user-FTP sono mostrati tra parentesi, ----> rappresenta i comandi dall'HOST U all'HOST S e <---- rappresenta le risposte dall'HOST S all'HOST U.

Local Commands by User                  Action Involved

ftp (host) multics CR ICP to HOST S, socket 3,
establishing TELNET connections.
username Doe CR USER DoeCRLF ---->
<---- 330 passwordCRLF
password mumble CR PASS mumbleCRLF ---->
<---- 230 Doe logged in.CRLF
retrieve (local type ASCIICR
(local pathname) test 1 CR USER-FTP open local file in ASCII.
(for. pathname) test.pl1CR RETR test.pl1 CRLF ---->
<---- 255 SOCK 1233CRLF
Server makes data connection to (U+4).
<---- 250 File transfer startsCRLF
<---- 252 File transfer completeCRLF
type imageCR TYPE |CRLF ---->
<---- 200 Command OKCRLF
byte 36CR BYTE 36CRLF ---->
<---- 200 Command OKCRLF
store (local type) ImageCR
(local pathname) file dumpCR User-FTP opens local file in Image.
(for. pathname) >udd>cn>fdCR STOR >udd>cn>fdCRLF ---->
<---- 451 Access deniedCRLF
terminate BYECRLF
<---- 231 Doe logged outCRLF
Server closes all connections.