![Page 1: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/1.jpg)
Datornätverk A – lektion 14:Applikationslagret
Kap 24: SocketsKapitel 25: DNS
Kapitel 26: SMTP och FTPKapitel 27: HTTP och WWW
![Page 2: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/2.jpg)
Application LayerApplication Layer
PART VIPART VI
![Page 3: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/3.jpg)
Position of application layer
![Page 4: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/4.jpg)
Chapter 24
Client-ServerModel:
Socket Interface
![Page 5: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/5.jpg)
Figure 24.2 Client-server relationship
![Page 6: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/6.jpg)
Figure 24.3 Connectionless iterative server
![Page 7: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/7.jpg)
Figure 24.4 Connection-oriented concurrent server
![Page 8: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/8.jpg)
Figure 24.6 Socket types
![Page 9: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/9.jpg)
Figure 24.7 Socket interface for connectionless iterative server
![Page 10: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/10.jpg)
Figure 24.8 Socket interface for connection-oriented concurrent server
![Page 11: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/11.jpg)
Chapter 25
DNS = DomainName System
![Page 12: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/12.jpg)
Figure 25.1 Domain name space
![Page 13: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/13.jpg)
Domain Name System - DNS
En distribuerad databas som används till att koppla IP-nummer till textbaserade internetadresser.
Ex www.gb.se <-> 195.7.73.37
• Varje sökning utgår från någon av rootservrarna som håller ordning på toppdomänerna. (.com .edu .se m fl)
• All information rörande en domän ligger i den ”Name Server” som hanterar domänen.
• För att lägga upp en ny domän krävs ”tillstånd” från närmast högre
![Page 14: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/14.jpg)
Figure 25.2 Domain names and labels
![Page 15: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/15.jpg)
Figure 25.4 Domains
![Page 16: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/16.jpg)
Figure 25.5 Hierarchy of name servers
![Page 17: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/17.jpg)
A primary DNS server loads all information from the disk file; the
secondary server loads all information from the primary server.
NoteNote::
![Page 18: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/18.jpg)
Figure 25.7 DNS in the Internet
![Page 19: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/19.jpg)
Table 25.1 Table 25.1 Generic domain labelsGeneric domain labels
Label Description
.com Commercial organizations
.edu Educational institutions
.gov Government institutions
.int International organizations
.mil Military groups
.net Network support centers
.org Nonprofit organizations
![Page 20: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/20.jpg)
Table 25.2 Table 25.2 New generic domain labelsNew generic domain labels
Label Description
.aero Airlines and aerospace companies
.biz Businesses or firms (similar to com)
.coop Cooperative business organizations
.info Information service providers
.museum Museums and other nonprofit organizations
.name Personal names (individuals)
.pro Professional individual organizations
![Page 21: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/21.jpg)
Figure 25.9 Country domains
![Page 22: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/22.jpg)
Figure 25.10 Inverse domain
![Page 23: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/23.jpg)
Figure 25.11 Recursive resolution
![Page 24: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/24.jpg)
Figure 25.12 Iterative resolution
![Page 25: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/25.jpg)
Figure 25.13 Query and response messages
![Page 26: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/26.jpg)
Figure 25.14 Header format
![Page 27: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/27.jpg)
DNS can use the services of UDP or TCP,
using the well-known port 53.
NoteNote::
![Page 28: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/28.jpg)
• Elektronisk Post via SMTP, POP eller IMAP• Konferenssystem via USENET News och NNTP• Fildelning via t.ex NFS• Filöverföring via t.ex FTP• Skrivardelning• World Wide Web via HTTP• Massutsändningar Mbone - Multicast Backbone
LAN Tjänster
![Page 29: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/29.jpg)
Chapter 26
Internet E-mail
![Page 30: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/30.jpg)
Figure 26.10 Email delivery
![Page 31: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/31.jpg)
Figure 26.11 POP3
![Page 32: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/32.jpg)
Figure 26.1 Format of an email
![Page 33: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/33.jpg)
Figure 26.2 Email address
![Page 34: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/34.jpg)
Figure 26.3 User agent
![Page 35: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/35.jpg)
Figure 26.4 MIME
![Page 36: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/36.jpg)
Figure 26.5 MIME header
![Page 37: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/37.jpg)
Table 26.1Table 26.1 Data types and subtypes in MIMEData types and subtypes in MIME Type Subtype Description
Text Plain Unformatted text
Multiport
Mixed Body contains ordered parts of different data types
Parallel Same as above, but no order
Digest Similar to mixed, but the default is message/RFC822
Alternative Parts are different versions of the same message
Message
RFC822 Body is an encapsulated message
Partial Body is a fragment of a bigger message
Ext. Body Body is a reference to another message
ImageJPEG Image is in JPEG
GIF Image is in GIF format
Video MPEG Video is in MPEG format
Audio Basic Single-channel encoding of voice at 8 KHz
ApplicationPostScript Adobe PostScript
Octet-Stream General binary data (8-bit bytes)
![Page 38: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/38.jpg)
Table 26.2 Table 26.2 Content-transfer encodingContent-transfer encoding
Category Description
Type ASCII characters and short lines
7bit Non-ASCII characters and short lines
8bit Non-ASCII characters with unlimited-length lines
Binary 6-bit blocks of data are encoded into 8-bit ASCII characters
Base64 Non-ASCII characters are encoded as an equal sign followed by an ASCII code
![Page 39: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/39.jpg)
Figure 26. 6 Base64
![Page 40: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/40.jpg)
Table 26.3 Table 26.3 Base64 encoding tableBase64 encoding table
Value Code Value Code Value Code Value Code Value Code Value Code
0 A 11 L 22 W 33 h 44 s 55 3
1 B 12 M 23 X 34 i 45 t 56 4
2 C 13 N 24 Y 35 j 46 u 57 5
3 D 14 O 25 Z 36 k 47 v 58 6
4 E 15 P 26 a 37 l 48 w 59 7
5 F 16 Q 27 b 38 m 49 x 60 8
6 G 17 R 28 c 39 n 50 y 61 9
7 H 18 S 29 d 40 o 51 z 62 +
8 I 19 T 30 e 41 p 52 0 63 /
9 J 20 U 31 f 42 q 53 1
10 K 21 V 32 g 43 r 54 2
![Page 41: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/41.jpg)
Figure 26.7 Quoted-printable
![Page 42: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/42.jpg)
Figure 26.8 Email client and server
![Page 43: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/43.jpg)
26.2 File Transfer 26.2 File Transfer
Connections
Communication
File Transfer
User Interface
Anonymous
![Page 44: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/44.jpg)
FTP uses the services of TCP. It needs two TCP connections. The well-known
port 21 is used for the control connection, and the well-known port 20 is used for the data connection.
NoteNote::
![Page 45: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/45.jpg)
Figure 26.12 FTP
![Page 46: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/46.jpg)
Figure 26.13 Using the control connection
![Page 47: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/47.jpg)
Figure 26.14 Using the data connection
![Page 48: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/48.jpg)
Figure 26.15 File transfer
![Page 49: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/49.jpg)
Example 1Example 1
Figure 26.16 (next slide) shows an example of how a file is stored.
1. The control connection is created, and several control commands and responses are exchanged.
2. Data are transferred record by record.
3. A few commands and responses are exchanged to close the connection.
![Page 50: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/50.jpg)
Figure 26.16 Example 1
![Page 51: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/51.jpg)
Table 26.4 Table 26.4 List of FTP commands in UNIXList of FTP commands in UNIX
Commands
!, $, account, append, ascii, bell, binary, bye, case, cd, cdup, close, cr, delete, debug, dir, discount, form, get, glob, hash, help, lcd, ls, macdef, mdelete, mdir, mget, mkdir, mls, mode, mput, nmap, ntrans, open, prompt, proxy, sendport, put, pwd, quit, quote, recv, remotehelp, rename, reset, rmdir, runique, send, status, struct, sunique, tenex, trace, type, user, verbose,?
![Page 52: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/52.jpg)
Example 2Example 2We show some of the user interface commands that accomplish the same task as in Example 1. The user input is shown in boldface. As shown below, some of the commands are provided automatically by the interface. The user receives a prompt and provides only the arguments.
$ ftp challenger.atc.fhda.eduConnected to challenger.atc.fhda.edu220 Server readyName: forouzanPassword: xxxxxxxftp > ls /usr/user/report200 OK150 Opening ASCII mode......................226 transfer completeftp > close221 Goodbyeftp > quit
![Page 53: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/53.jpg)
Example 3Example 3We show an example of using anonymous FTP. We connect to internic.net, where we assume there are some public data available.
$ ftp internic.netConnected to internic.net220 Server readyName: anonymous331 Guest login OK, send "guest" as passwordPassword: guestftp > pwd257 '/' is current directoryftp > ls200 OK150 Opening ASCII modebin...ftp > close221 Goodbyeftp > quit
![Page 54: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/54.jpg)
Chapter 27
HTTPand
WWW
![Page 55: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/55.jpg)
HTTP uses the services of TCP on well-known port 80.
NoteNote::
![Page 56: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/56.jpg)
Figure 27.1 HTTP transaction
![Page 57: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/57.jpg)
Figure 27.9 Example 1
![Page 58: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/58.jpg)
Example 1Example 1This example retrieves a document. We use the GET method to retrieve an image with the path /usr/bin/image1. The request line shows the method (GET), the URL, and the HTTP version (1.1). The header has two lines that show that the client can accept images in GIF and JPEG format. The request does not have a body. The response message contains the status line and four lines of header. The header lines define the date, server, MIME version, and length of the document. The body of the document follows the header (see Fig. 27.9, next slide).
![Page 59: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/59.jpg)
Figure 27.3 Request line
![Page 60: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/60.jpg)
Figure 27.4 URL
![Page 61: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/61.jpg)
Figure 27.6 Status line
![Page 62: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/62.jpg)
Figure 27.7 Header format
![Page 63: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/63.jpg)
Figure 27.10 Example 2
![Page 64: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/64.jpg)
Example 2Example 2
This example retrieves information about a document. We use the HEAD method to retrieve information about an HTML document (see the next section). The request line shows the method (HEAD), URL, and HTTP version (1.1). The header is one line showing that the client can accept the document in any format (wild card). The request does not have a body. The response message contains the status line and five lines of header. The header lines define the date, server, MIME version, type of document, and length of the document (see Fig. 27.10, next slide). Note that the response message does not contain a body.
![Page 65: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/65.jpg)
HTTP version 1.1 specifies a persistent connection by default.
NoteNote::
![Page 66: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/66.jpg)
Figure 27.12 Hypertext
![Page 67: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/67.jpg)
Figure 27.11 WWW
Hyperlinks
![Page 68: Datornätverk A – lektion 14: Applikationslagret](https://reader035.vdocument.in/reader035/viewer/2022081515/56814c04550346895db902e6/html5/thumbnails/68.jpg)
Figure 27.13 Browser architecture