09 maggio 2012 - SisInfLab

Transcript

09 maggio 2012 - SisInfLab
Corso di Laurea in
Ingegneria Informatica
Ingegneria delle Telecomunicazioni
Appello di Telematica II
9 maggio 2012
COGNOME:_________________ NOME: __________________ MATR.:_____________ CdL:__________
TEMPO TOTALE A DISPOSIZIONE: 75 minuti
Quesito n. 1 (4 punti)
Si provveda a spiegare il significato dei seguenti comandi relativi al protocollo SMTP:
HELO <sender>
RCPT To: <recipient>
RSET
VRFY <recipient>
NOOP
Quesito n. 2 (4 punti)
Si spieghi in modo conciso e compendioso il funzionamento della risoluzione inversa DNS. A partire da quale
livello la risoluzione torna ad essere operata localmente?
Corso di TELEMATICA II
CdL Ing. Informatica
Ing. delle Telecomunicazioni
Corso di Laurea in
Ingegneria Informatica
Ingegneria delle Telecomunicazioni
Appello di Telematica II
Quesito n. 3 (4 punti)
Si spieghi a cosa fanno riferimento e cosa significano le direttive seguenti:
Listen *:80
User michele
Group sisinflab_poliba
ServerAdmin [email protected]
ServerName root.poliba.it
DocumentRoot "/var/www/html”
ErrorLog "/var/log/httpd/error_log”
CustomLog logs/custom_log
Quesito n. 4 (4 punti)
Si provveda a disegnare una rete peer to peer fatta da 10 nodi di cui:
- N. 2 tracker
- N. 3 seeder
- N. 5 leecher
Si faccia attenzione a segnare i collegamenti possibili tra gli attori coinvolti con simbologie diverse a seconda
della tipologia. Si commenti lo schema realizzato.
Corso di TELEMATICA II
CdL Ing. Informatica
Ing. delle Telecomunicazioni
Corso di Laurea in
Ingegneria Informatica
Ingegneria delle Telecomunicazioni
Appello di Telematica II
Quesito n. 5 (14 punti)
Si realizzi, in linguaggio Java, un metodo che gestisca una sessione FTP lato server. Il metodo sia dichiarato
come
private void serve(Socket s) {
// corpo da implementare
}
ove s è un socket già correttamente inizializzato e pronto per la comunicazione con il client (si suppone cioè che
la connessione sia stata già stabilita – ad esempio mediante la chiamata al metodo accept di un oggetto di
classe ServerSocket – quando viene invocato il metodo serve).
Occorrerà sviluppare anche gli eventuali metodi usati dal suddetto metodo serve e dichiarare gli attributi esterni
al metodo eventualmente adoperati. Non occorre, invece, sviluppare l'intera classe Java che rappresenta un
server FTP completo.
Il server FTP implementi i seguenti comandi:
•
CWD subdirectory
•
LIST [subdirectory]
•
QUIT
Per brevità si faccia a meno dei comandi per effettuare il login.
Si implementi unicamente la modalità attiva per il trasferimento dei dati. Si ipotizzi che il percorso della directory
radice per FTP sia /var/ftp/
Occorre infine usare correttamente i seguenti codici di risposta previsti dal protocollo (sostituire di volta in volta la
x con l'opportuna cifra indicante la categoria della risposta):
Codice e testo di risposta
x50 Requested action okay.
x50 Status okay; about to open data connection.
x20 Java FTP Server.
x21 Goodbye.
x26 Send OK; closing data connection.
x25 Can't open data connection.
x26 Connection closed; transfer aborted.
x02 Command not implemented.
Corso di TELEMATICA II
CdL Ing. Informatica
Ing. delle Telecomunicazioni
Corso di Laurea in
Ingegneria Informatica
Ingegneria delle Telecomunicazioni
Appello di Telematica II
Javadoc
java.io.File
public File(String pathname)
Creates a new File instance using the given pathname.
public boolean exists()
Tests whether the file or directory exists.
public String[] list()
Returns an array of strings naming the files and directories in the directory
denoted by this abstract pathname. If this abstract pathname does not denote a
directory, then this method returns null. Otherwise an array of strings is
returned, one for each file or directory in the directory.
public boolean isDirectory()
Tests whether the file denoted by this abstract pathname is a directory.
java.lang.String
public boolean endsWith(String suffix)
Tests if this string ends with the specified suffix.
public boolean equals(Object o)
Compares this string to the specified object.
public int indexOf(String str)
Returns the index within this string of the first occurrence of the
specified substring.
Parameters: str - the substring for which to search.
Returns:
if the string argument occurs as a substring within this object,
then the index of the first character of the first such substring is returned; if
it does not occur as a substring, -1 is returned.
public int indexOf(String str, int fromIndex)
Returns the index within this string of the first occurrence of the
specified substring, starting at the specified index.
Parameters: str - the substring for which to search.
fromIndex - the index from which to start the search.
Returns:
the index, within this string, of the first character of the
first occurrence of the specified substring, starting at the specified index; if
it does not occur as a substring, -1 is returned.
public int length()
Returns the length of this string.
public boolean startsWith(String prefix)
Tests if this string starts with the specified prefix.
public String substring(int beginIndex)
Returns a new string that is a substring of this string.
public String substring(int beginIndex, int endIndex)
Returns a new string that is a substring of this string.
java.lang.StringBuffer
public StringBuffer append(String str)
Appends the string to this string buffer.
Corso di TELEMATICA II
CdL Ing. Informatica
Ing. delle Telecomunicazioni