2: Application Layer1 DNS: Domain Name System Persone: molte mezzi di identificazione: m CF, nome, # Passaporto Host, router Internet: m Indirizzi IP (32.

Slides:



Advertisements
Presentazioni simili
Cache Memory Prof. G. Nicosia University of Catania
Advertisements

Socket Java Alberto Ferrari.
RTP MIDI – parte 2 Lezione 16
WSDL (Web Services Description Language) Laurea Magistrale in Informatica Reti 2 (2006/07) dott. Federico Paoloni
Programmazione con socket
JPA Overview della tecnologia. Java Persistence Architecture Definita nella JSR-220 EJB 3.0 ( Tentativo di unificare EJB2.1 con.
Applicazioni Telematiche delle reti tra calcolatori E.Mumolo. DEEI
L'interfaccia socket in Java
1.E un algoritmo ricorsivo: Tutti le istanze di oggetti raggiungibili da un oggetto persistente diventano anchessi persistenti.
ING. CARLO MANFUCCI COMUNE DI GROSSETO
Programmazione socket
DNS: Il Servizio Directory di Internet
La rete in dettaglio: rete esterna (edge): applicazioni e host
Come programmare servizi di rete?
Esempio: Tombola! Parte seconda.
Richiami di TCP Networking in Java Elementi di base.
Sezione: Costruttori Costruttori. Definizione dei costruttori Se per una classe A non scrivo nessun costruttore, il sistema automaticamente crea il costruttore.
prompt> java SumAverage
J0 1 Marco Ronchetti - Java Networking TCP.
Directory services Directory offline –Elenchi telefonici –Guide TV –Cataloghi acquisti Directory online –Application specific (lotus notes, MS Exchange.
Biometry to enhance smart card security (MOC using TOC protocol)
Costruzione di Interfacce Lezione 10 Dal Java al C++ parte 1
Comunicazione on-line, reti e virtualità Matteo Cristani.
1. Conoscere luso delle collezioni in Java Comprendere le principali caratteristiche nelle varie classi di Collection disponibili Saper individuare quali.
JAVA C import java.util.*; #include <stdio.h>
Livello applicativo Obiettivi generali: Obiettivi specifici:
Programming with JXTA Hello World Peer discovery Peer Group discovery Creating Peer group Joining a Peer Group.
2000 Prentice Hall, Inc. All rights reserved. 1 Capitolo 3 - Functions Outline 3.1Introduction 3.2Program Components in C++ 3.3Math Library Functions 3.4Functions.
Reti di Calcolatori Seconda lezione: Livello applicazione
2: Application Layer1 DNS: Domain Name System Identificazione Persone: m Cod.Fiscale, nome, Passaporto Internet hosts, routers: m indirizzo IP (32 bit)
Docente: Gabriele Lombardi
IL LIVELLO APPLICAZIONI:
Programmazione distribuita in Java
Reti di Calcolatori IL LIVELLO TRASPORTO Protocolli TCP e UDP.
4 Cosa è una rete? ã Punto di vista logico: sistema di dati ed utenti distribuito ã Punto di vista fisico: insieme di hardware, collegamenti, e protocolli.
ICMP - PING - TRACEROUTE
Componenti dell’architettura Oracle
JAVA E LA RETE L’architettura Java è network-ready
Capitolo 2 Livello di applicazione
Mobile e Social per portare traffico nei negozi H&m Isabella Federico.
INTERNET Antonio Papa Classe 2^ beat I.S.I.S. G. Meroni a.s. 2007/2008.
Cosè una rete Scambio di informazioni Perchè una rete.
POSTA ELETTRONICA PER GLI STUDENTI DI ECONOMIA POSTA SU HOST b Host e terminali La base dati dei messaggi risiede sul mainframeLa base dati dei messaggi.
LE RETI E IL DDNS.
Project Review byNight byNight December 6th, 2011.
Cosa è una applicazione distribuita?
Fabio Cozzolino Vito Arconzo
Controllo remoto di dispositivi tecnologici via TCP/IP.
Soluzioni 1.Struttura base soluzione 2.Lettura dei tasti 3.Identificazione dei tasti 4.Accensione dei LED 5.Rotazione dei LED 6.Rotazione dei tasti fino.
Visual Studio Tools for Office: Developer Solutions Platform Fulvio Giaccari MCSD.NET / MCT Responsabile Usergroup ShareOffice Blog:
Project Review Novembrer 17th, Project Review Agenda: Project goals User stories – use cases – scenarios Project plan summary Status as of November.
Project Review byNight byNight December 6th, 2011.
Project Review Novembrer 17th, Project Review Agenda: Project goals User stories – use cases – scenarios Project plan summary Status as of November.
Modulo 3 – U.D. 3 – Lez. 1 Ernesto Damiani - Sistemi di elaborazione dell'informazione.
Negli ultimi anni, la richiesta di poter controllare in remoto la strumentazione e cresciuta rapidamente I miglioramenti nell’hardware e nel software insieme.
Collection & Generics in Java
Sistemi di elaborazione dell’informazione Modulo 3 -Protocolli applicativi Unità didattica 4 - Protocolli del Web Ernesto Damiani Lezione 3 – Esempi HTTP.
JDBC Java DataBase Connectivity SISTEMI ITIS B. CASTELLI Anno Scolastico
Distributed System ( )7 TCP/IP four-layer model.
Come comunicano i processi ?
Introduction1-1 Reti di calcolatori e Sicurezza -- Application Layer --- Part of these slides are adapted from the slides of the book: Computer Networking:
Tutti noi siamo abituati a raggiungere un servizio (e quindi il calcolatore che lo offre) utilizzando nomi simbolici e di facile memorizzazione detti hostname:
Socket programming in Java La realizzazione di un server in Java consente di scrivere una sola versione eseguibile su diverse piattaforme. Il linguaggio.
Socket programming in Java La realizzazione di un server in Java consente di scrivere una sola versione eseguibile su diverse piattaforme. Il linguaggio.
I socket.
DNS Domain Name Server.
Come comunicano i processi ?
Corso di Reti di Calcolatori Programmazione Java
Il Livello di Trasporto
Transcript della presentazione:

2: Application Layer1 DNS: Domain Name System Persone: molte mezzi di identificazione: m CF, nome, # Passaporto Host, router Internet: m Indirizzi IP (32 bit) – usati per indirizzare i datagrammi IP m Nome, es., gaia.cs.umass.edu – usati dagli utenti Q: corrispondenza tra indirizzo IP e nome? Domain Name System: r Database distribuito implementato come una gerarchia di molti name server r Protocollo applicativo usato da host, router, name server per comunicare allo scopo di risolvere (tradurre) i nomi in indirizzi IP m Nota: funzione di base di Internet implementata come protocollo applicativo m La complessità trasferita al bordo della rete

2: Application Layer2 Funzione del DNS r Utilizzato da diverse aplicazioni: HTTP, SMTP, FTP r Connessione TCP richiede la conoscenza dellindirizzo IP corrispondente allhostname r Applicazione interroga un sever DNS per ottenere lindirizzo IP r Opportuno utilizzare la cache per ridurre il ritardo r Utilizza UDP r UNIX: gethostbyname() r Fornisce lhostname corrispondente ad un alias r Alias di posta: fornisce lindirizzo IP o lhostname del Mail Server di un dominio r Distribuzione del carico tra Server replicati. IL DNS fornisce un gruppo di indirizzi alternando lordine r Permette di dirigere un client al server più vicino

2: Application Layer3 Name server DNS r Nessun name server contiene tutte le associazioni nome simbolico/indirizzo IP Name server locali : m Ogni ISP o compagnia ha un name server locale (default) m La richiesta di traduzione (mapping) di un host è prima rivolta al name server locale Name server di riferimento : m Per un host: per definizione è quello che è sempre in grado di eseguire la traduzione (mapping) nome simbolico/indirizzo IP dell host Perché non un server DNS centralizzato? r Minore tolleranza ai guasti r Traffico eccessivo r Database centrale troppo distante in molti casi r Scarsa scalabilità! r Autorizzazione ed accesso per registrare nuovo host

2: Application Layer4 DNS: Root name servers r Contattato dal name server locale che non riesce a risolvere un nome r root name server: m Contatta il name server di riferimento (authoritative) se la traduzione non è nota m Ottiene la traduzione m Restituisce la traduzione al name server locale r ~ una dozzina di root name server nel mondo

2: Application Layer5 Esempio: schema ricorsivo L host surf.eurecom.fr vuole lindirizzo IP di gaia.cs.umass.edu 1. Contatta il server DNS locale, dns.eurecom.fr 2. dns.eurecom.fr contatta il root name server, se necessario 3. Il root name server contatta il name server di riferimento o assoluto, dns.umass.edu, se necessario 4. Ogni host è registrato in almeno due name server assoluti 4. Il name server assoluto può coincidere con il neame server locale. Host che inoltra la richiesta surf.eurecom.fr gaia.cs.umass.edu root name server authorititive name server dns.umass.edu local name server dns.eurecom.fr

2: Application Layer6 Esempio (2) Root name server: r Può non essere a conoscenza di un name server di riferimento r Può tuttavia conoscere un name server intermedio che contatta per avere raggiungere quello di riferimento Host che inoltra la richiesta surf.eurecom.fr gaia.cs.umass.edu root name server local name server dns.eurecom.fr Name server di riferimento dns.cs.umass.edu Name server intermedio dns.umass.edu 7 8

2: Application Layer7 DNS: richieste ripetute (iterated queries) Richieste ricorsive (recursive query): r Trasferisce il carico della traduzione al name server contattato r Carico eccessivo? Richieste ripetute (iterated query): r Il name server contattato risponde con lindirizzo del prossimo name server da contattare r Non conosco questo nome, ma prova a rivolgerti a questaltro server Host che inizia la richiesta surf.eurecom.fr gaia.cs.umass.edu root name server Name server locale dns.eurecom.fr authoritative name server dns.cs.umass.edu Name server intermedio dns.umass.edu 7 8 Richiesta ripetuta

2: Application Layer8 DNS: caching e aggiornamento r Quando un qualsiasi name server apprende una traduzione la memorizza localmente (caching) m Le traduzioni memorizzate nella cache (cache entries) scadono (timeout) dopo un certo tempo (di solito un paio di giorni) r Se possibile, richieste successive vengono servite usando la traduzione presente in cache r I meccanismi di aggiornmento/modifica in studio da parte dell IETF m RFC 2136 m

2: Application Layer9 Record DNS DNS: database distribuito che memorizza Resource Record (RR) r Tipo=NS nome è il dominio (es. foo.com) valore è lindirizzo IP del name server di riferimento per questo dominio Formato RR: (nome, valore, tipo, ttl) r Tipo=A nome è il nome dell host valore è l indirizzo IP r Tipo=CNAME nome è un alias di qualche nome reale (canonico) valore è il nome canonico r Tipo=MX valore è il nome di un mailserver associato a nome

2: Application Layer10 Protocollo DNS, messaggi Protocollo DNS : messaggi di richiesta (query) e risposta (reply), client server Header di messaggio r identification: numero a 16 bit per la richiesta, la risposta usa lo stesso numero r flags: m Richiesta o risposta m Chiesta la ricorsione (Q) m Ricorsione disponibile (R) m Il server che risponde è di riferimento per la richiesta (R) Nota: richiesta e risposta hanno lo stesso formato

2: Application Layer11 Protocollo DNS, messaggi (2) Nome, campi tipo per una richiesta RR in risposta a una richiesta Record per server di riferimento Informazioni addizionali Es.: RR di tipo A contenente indirizzo IP di un mail server il cui nome canonico è contenuto nella answer section

2: Application Layer12 Esercizi 1. Come vengono trattati oggetti multipli allinterno di una pagina Web e di un MIME Multipart 2. Come sono separati gli oggetti in una connessione permamente HTTP e differenti messaggi una connessione permamente SMTP 3. Quali protocolli studiati finora sono di tipo Pull e quali di tipo Push

2: Application Layer13 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm r two types of transport service via socket API: m unreliable datagram m reliable, byte stream- oriented a host-local, application- created/owned, OS-controlled interface (a door) into which application process can both send and receive messages to/from another (remote or local) application process socket Goal: learn how to build client/server application that communicate using sockets

2: Application Layer14 Socket-programming using TCP Socket: a door between application process and end- end-transport protocol (UCP or TCP) TCP service: reliable transfer of bytes from one process to another process TCP with buffers, variables socket controlled by application developer controlled by operating system host or server process TCP with buffers, variables socket controlled by application developer controlled by operating system host or server internet

2: Application Layer15 Socket programming with TCP Client must contact server r server process must first be running r server must have created socket (door) that welcomes clients contact Client contacts server by: r creating client-local TCP socket r specifying IP address, port number of server process r When client creates socket: client TCP establishes connection to server TCP r When contacted by client, server TCP creates new socket for server process to communicate with client m allows server to talk with multiple clients TCP provides reliable, in-order transfer of bytes (pipe) between client and server application viewpoint

2: Application Layer16 Socket programming with TCP Example client-server app: client reads line from standard input ( inFromUser stream), sends to server via socket ( outToServer stream) r server reads line from socket r server converts line to uppercase, sends back to client client reads, prints modified line from socket ( inFromServer stream) Input stream: sequence of bytes into process Output stream: sequence of bytes out of process client socket inFromUser outToServer iinFromServer

2: Application Layer17 Client/server socket interaction: TCP wait for incoming connection request connectionSocket = welcomeSocket.accept() create socket, port= x, for incoming request: welcomeSocket = ServerSocket() create socket, connect to hostid, port= x clientSocket = Socket() close connectionSocket read reply from clientSocket close clientSocket Server (running on hostid ) Client send request using clientSocket read request from connectionSocket write reply to connectionSocket TCP connection setup

2: Application Layer18 Example: Java client (TCP) import java.io.*; import java.net.*; class TCPClient { public static void main(String argv[]) throws Exception { String sentence; String modifiedSentence; BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); Socket clientSocket = new Socket("hostname", 6789); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); Create input stream Create client socket, connect to server Create output stream attached to socket

2: Application Layer19 Example: Java client (TCP), cont. BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); sentence = inFromUser.readLine(); outToServer.writeBytes(sentence + '\n'); modifiedSentence = inFromServer.readLine(); System.out.println ("FROM SERVER: " + modifiedSentence ); clientSocket.close(); } Create input stream attached to socket Send line to server Read line from server

2: Application Layer20 Example: Java server (TCP) import java.io.*; import java.net.*; class TCPServer { public static void main(String argv[]) throws Exception { String clientSentence; String capitalizedSentence; ServerSocket welcomeSocket = new ServerSocket(6789); while(true) { Socket connectionSocket = welcomeSocket.accept(); BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); Create welcoming socket at port 6789 Wait, on welcoming socket for contact by client Create input stream, attached to socket

2: Application Layer21 Example: Java server (TCP), cont DataOutputStream outToClient = new DataOutputStream (connectionSocket.getOutputStream()); clientSentence = inFromClient.readLine(); capitalizedSentence = clientSentence.toUpperCase() + '\n'; outToClient.writeBytes(capitalizedSentence); } Read in line from socket Create output stream, attached to socket Write out line to socket End of while loop, loop back and wait for another client connection

2: Application Layer22 Socket programming with UDP UDP: no connection between client and server r no handshaking r sender explicitly attaches IP address and port of destination r server must extract IP address, port of sender from received datagram UDP: transmitted data may be received out of order, or lost application viewpoint UDP provides unreliable transfer of groups of bytes (datagrams) between client and server

2: Application Layer23 Client/server socket interaction: UDP close clientSocket Server (running on hostid ) read reply from clientSocket create socket, clientSocket = DatagramSocket() Client Create, address ( hostid, port=x, send datagram request using clientSocket create socket, port= x, for incoming request: serverSocket = DatagramSocket() read request from serverSocket write reply to serverSocket specifying client host address, port umber

2: Application Layer24 Example: Java client (UDP) import java.io.*; import java.net.*; class UDPClient { public static void main(String args[]) throws Exception { BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); DatagramSocket clientSocket = new DatagramSocket(); InetAddress IPAddress = InetAddress.getByName("hostname"); byte[] sendData = new byte[1024]; byte[] receiveData = new byte[1024]; String sentence = inFromUser.readLine(); sendData = sentence.getBytes(); Create input stream Create client socket Translate hostname to IP address using DNS

2: Application Layer25 Example: Java client (UDP), cont. DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 9876); clientSocket.send(sendPacket); DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); clientSocket.receive(receivePacket); String modifiedSentence = new String(receivePacket.getData()); System.out.println("FROM SERVER:" + modifiedSentence); clientSocket.close(); } Create datagram with data-to-send, length, IP addr, port Send datagram to server Read datagram from server

2: Application Layer26 Example: Java server (UDP) import java.io.*; import java.net.*; class UDPServer { public static void main(String args[]) throws Exception { DatagramSocket serverSocket = new DatagramSocket(9876); byte[] receiveData = new byte[1024]; byte[] sendData = new byte[1024]; while(true) { DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); serverSocket.receive(receivePacket); Create datagram socket at port 9876 Create space for received datagram Receive datagram

2: Application Layer27 Example: Java server (UDP), cont String sentence = new String(receivePacket.getData()); InetAddress IPAddress = receivePacket.getAddress(); int port = receivePacket.getPort(); String capitalizedSentence = sentence.toUpperCase(); sendData = capitalizedSentence.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port); serverSocket.send(sendPacket); } Get IP addr port #, of sender Write out datagram to socket End of while loop, loop back and wait for another datagram Create datagram to send to client

2: Application Layer28 Chapter 2: Summary r application service requirements: m reliability, bandwidth, delay r client-server paradigm r Internet transport service model m connection-oriented, reliable: TCP m unreliable, datagrams: UDP Our study of network apps now complete! r specific protocols: m http m ftp m smtp, pop3 m dns r socket programming m client/server implementation m using tcp, udp sockets

2: Application Layer29 Chapter 2: Summary r typical request/reply message exchange: m client requests info or service m server responds with data, status code r message formats: m headers: fields giving info about data m data: info being communicated Most importantly: learned about protocols r control vs. data msgs m in-based, out-of-band r centralized vs. decentralized r stateless vs. stateful r reliable vs. unreliable msg transfer r complexity at network edge r security: authentication