4-traditional internet applications

80
4-Traditional Internet Applications Dr. John P. Abraham Professor UTPA

Upload: raanan

Post on 21-Jan-2016

26 views

Category:

Documents


0 download

DESCRIPTION

4-Traditional Internet Applications. Dr. John P. Abraham Professor UTPA. External references. Your book provides limited amount of information. Please note that I have used Forouzan to supplement this chapter. Refer to the syllabus. Application Layer Protocols. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 4-Traditional Internet Applications

4-Traditional Internet Applications

Dr. John P. Abraham

Professor

UTPA

Page 2: 4-Traditional Internet Applications

External references

• Your book provides limited amount of information. Please note that I have used Forouzan to supplement this chapter. Refer to the syllabus.

Page 3: 4-Traditional Internet Applications

Application Layer Protocols

• Two broad types of protocols for this layer:– Private communication: programmer creates a

pair of applications that communicate over the internet with intention it is for private use.

– Standardized service. Example is a server service. All types of users will use it. The specification must be precise and unambiguous so that all can interoperate correctly.

Page 4: 4-Traditional Internet Applications

Representation and Transfer

• Data Representation: Syntax of data items that are exchanged. Specific form used during transfer, translation of integers, characters, and files between computers.

• Data transfer. Interaction between client and server, message syntax and semantics, valid and invalid exchange error handling, termination of interaction.

Page 5: 4-Traditional Internet Applications

Web protocols

• HTML – a representation standard of a web page.

• URL – specify the location of a page.

• HTTP – transfer protocol that browser uses to communicate with the webserver.– Request types: get, head, post, put.

• I leave detailed description because it is pretty elementary.

Page 6: 4-Traditional Internet Applications

HTTP Requests

• GET: requests a document. Server send status information and the document.

• HEAD: Requests status information. Server sends just the status not the document.

• POST: Sends data to the server. The server appends the data to a specified item.

• PUT: Same as above, except, instead of appending it replaces previous data.

Page 7: 4-Traditional Internet Applications

Response Header

• Version of the HTTP protocol.

• Status code (whether the server handled the request – code 200). Code 404 means item can’t be found, 400 means bad request.

• Other information. Server identification. Last Modified. Content length and Content Type. All followed by CRLF.

Page 8: 4-Traditional Internet Applications

Caching In Browsers

• Important optimization technique to reduce download times by saving a copy of each image in a cache on the user’s disk.

• If the document changes the ‘Head request to server’ will sent last modified date and time which is compared with the cached copy. If the local copy is stale a new one is downloaded.

Page 9: 4-Traditional Internet Applications

Browser Architecture p 59.

Page 10: 4-Traditional Internet Applications

FTP

• Can transfer any type of data• Bidirectional transfer• Supports access restrictions• Ability to browse folders• Control messages are exchanged in ASCII• Supports heterogeneity

Page 11: 4-Traditional Internet Applications

FTP connections

• Two connections– Control– Data– Use different port numbers: Server uses port 21 and

waits for the client (Passive open). Client uses ephemeral port and issues an active open. The server then issues an active open (client takes and active role by sending a TCP message to start the connection – SYN) using port 20 and the received port from the client and data transfer begins.

– Transmission modes: stream, block and compressed.

Page 12: 4-Traditional Internet Applications

Figure 19.1 FTP

• The following two slides are very important. Please know the contents.

Page 13: 4-Traditional Internet Applications

FTP Active Passive Opens

• FTP can be run in active or passive mode, which determine how the data connection is established. In active mode, the client sends the server the IP address and port number on which the client will listen, and the server initiates the TCP connection. In situations where the client is behind a firewall and unable to accept incoming TCP connections, passive mode may be used. In this mode the client sends a PASV command to the server and receives an IP address and port number in return. The client uses these to open the data connection to the server.

Page 14: 4-Traditional Internet Applications

FTP active passive contd.

• A client makes a TCP connection to the server's port 21. This connection, called the control connection, remains open for the duration of the session, with a second connection, called the data connection, either opened by the server from its port 20 to a negotiated client port (active mode) or opened by the client from an arbitrary port to a negotiated server port (passive mode) as required to transfer file data. The control connection is used for session administration (i.e., commands, identification, passwords) exchanged between the client and server using a telnet-like protocol. Due to this two-port structure, FTP is considered an out-of-band, as opposed to an in-band protocol such as HTTP.

Page 15: 4-Traditional Internet Applications

Table 19.1 Table 19.1 Access commands. \Access commands. \The following Slides are good references. If you are either The following Slides are good references. If you are either programming FTP, or a heavy user of FTP, you need to programming FTP, or a heavy user of FTP, you need to have this info.have this info.

Page 16: 4-Traditional Internet Applications

Table 19.2 Table 19.2 File management commandsFile management commands

Page 17: 4-Traditional Internet Applications

Table 19.3 Table 19.3 Data formatting commandsData formatting commands

Page 18: 4-Traditional Internet Applications

Table 19.4 Table 19.4 Port defining commandsPort defining commands

Page 19: 4-Traditional Internet Applications

Table 19.5 Table 19.5 File transfer commandsFile transfer commands

Page 20: 4-Traditional Internet Applications

Table 19.5 Table 19.5 File transfer commands (continued)File transfer commands (continued)

Page 21: 4-Traditional Internet Applications

Table 19.6 Table 19.6 Miscellaneous commandsMiscellaneous commands

Page 22: 4-Traditional Internet Applications

Table 19.7 Table 19.7 ResponsesResponses

Page 23: 4-Traditional Internet Applications

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

Page 24: 4-Traditional Internet Applications

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

Page 25: 4-Traditional Internet Applications

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

Page 26: 4-Traditional Internet Applications

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

Page 27: 4-Traditional Internet Applications

Figure 19.8 shows an example of using FTP for retrieving a list of items in a directory.

1. After the control connection to port 21 is created, the FTP server sends the 220 (service ready) response on the control connection.2. The client sends the USER command.3. The server responds with 331 (user name is OK, password is required).4. The client sends the PASS command.

5. The server responds with 230 (user login is OK)

Example 1

See Next Slide

Page 28: 4-Traditional Internet Applications

6. The client issues a passive open on an ephemeral port for the data connection and sends the PORT command (over the control connection) to give this port number to the server.7. The server does not open the connection at this time, but it prepares itself for issuing an active open on the data connection between port 20 (server side) and the ephemeral port received from the client. It sends response 150 (data connection will open shortly).8. The client sends the LIST message.9. Now the server responds with 125 and opens the data connection.

Example 1 (cONTINUED)

See Next Slide

Page 29: 4-Traditional Internet Applications

10. The server then sends the list of the files or directories (as a file) on the data connection. When the whole list (file) is sent, the server responds with 226 (closing data connection) over the control connection.11. The client now has two choices. It can use the QUIT command to request the closing of the control connection or it can send another command to start another activity (and eventually open another data connection). In our example, the client sends a QUIT command.12. After receiving the QUIT command, the server responds with 221 (service closing) and then closes the control connection.

Example 1 (cONTINUED)

See Next Slide

Page 30: 4-Traditional Internet Applications

Figure 19.8 Example 1

Page 31: 4-Traditional Internet Applications

The following shows an actual FTP session that parallels Example 1. The colored lines show the responses from the server control connection; the black lines show the commands sent by the client. The lines in white with black background shows data transfer.

Example 2

See Next Slide

$ ftp voyager.deanza.fhda.eduConnected to voyager.deanza.fhda.edu.220 (vsFTPd 1.2.1)530 Please login with USER and PASS.Name (voyager.deanza.fhda.edu:forouzan): forouzan331 Please specify the password.

Page 32: 4-Traditional Internet Applications

Example 2

Password:230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.ftp> ls reports227 Entering Passive Mode (153,18,17,11,238,169)150 Here comes the directory listing.

drwxr-xr-x 2 3027 411 4096 Sep 24 2002 businessdrwxr-xr-x 2 3027 411 4096 Sep 24 2002 personaldrwxr-xr-x 2 3027 411 4096 Sep 24 2002 school

226 Directory send OK.ftp> quit221 Goodbye.

Page 33: 4-Traditional Internet Applications

Figure 19.9 shows an example of how an image (binary) file is stored.1. After the control connection to port 21 is created, the FTP server sends the 220 (service ready) response on the control connection.2. The client sends the USER command.3. The server responds with 331 (user name is OK, a password is required).4. The client sends the PASS command.5. The server responds with 230 (user login is OK).6. The client issues a passive open on an ephemeral port for the data connection and sends the PORT command (over the control connection) to give this port number to the server.

Example 3

See Next Slide

Page 34: 4-Traditional Internet Applications

7. The server does not open the connection at this time, but prepares itself for issuing an active open on the data connection between port 20 (server side) and the ephemeral port received from the client. It sends the response 150 (data connection will open shortly).8. The client sends the TYPE command.9. The server responds with the response 200 (command OK).10. The client sends the STRU command.11. The server responds with 200 (command OK). 12. The client sends the STOR command.13. The server opens the data connection and sends the response 250.

Example 3 (cONTINUED)

See Next Slide

Page 35: 4-Traditional Internet Applications

14. The client sends the file on the data connection. After the entire file is sent, the data connection is closed. Closing the data connection means end-of-file.15. The server sends the response 226 on the control connection.16. The client sends the QUIT command or uses other commands to open another data connection for transferring another file. In our example, the QUIT command is sent.17. The server responds with 221 (service closing) and it closes the control connection.

Example 3 (cONTINUED)

See Next Slide

Page 36: 4-Traditional Internet Applications

Figure 19.9 Example 3

Page 37: 4-Traditional Internet Applications

We show an example of anonymous FTP. We assume thatsome public data are available at internic.net.

Example 4

See Next Slide

$ ftp internic.netConnected to internic.net220 Server readyName: anonymous331 Guest login OK, send “guest” as passwordPassword: guestftp > pwd257 ’/’ is current directory

Page 38: 4-Traditional Internet Applications

bin. . .. . .. . .

Example 4

ftp > close221 Goodbyeftp > quit

Page 39: 4-Traditional Internet Applications

TFTP

• Simply copy a file without all the features of FTP. Mostly used now for flashing routers, diskless workstations, etc. that are directly connected.

• Uses IP and UDP. Uses port number 69 initially, once it gets the ephemeral port from the client, the server opens its own ephemeral port to communicate, freeing port 69 to be used by someone else.

Page 40: 4-Traditional Internet Applications

Email

• MIME

• SMTP

• POP

• IMAP

Main components: User agents, message access agent, and transfer agents

Page 41: 4-Traditional Internet Applications

Components of email

User agent: used to compose mail, read mail, store in local computer (if two users are on the same LAN, we only need two user agents). Eg. Eudora, Outlook, Netscape.

MTAs (message transfer agents) to transfer from local machine to a server, server to another server and so on. SMTP

Message Access agent – to retrieve from the local server to the local recipient computer. Pop and IMAP, MIME

Page 42: 4-Traditional Internet Applications

Mime (multipurpose internet mail extenstion)

• Allows non-ASCII characters. Used for all languages, video, and audio.

Page 43: 4-Traditional Internet Applications

Figure 20.9 MIME

Page 44: 4-Traditional Internet Applications

Figure 20.10 MIME header

Page 45: 4-Traditional Internet Applications

Table 20.1 Table 20.1 Data types and subtypes in MIMEData types and subtypes in MIME

Page 46: 4-Traditional Internet Applications

Table 20.1 Table 20.1 Data types and subtypes in MIME (Continued)Data types and subtypes in MIME (Continued)

Page 47: 4-Traditional Internet Applications

Table 20.2 Table 20.2 Content-transfer-encodingContent-transfer-encoding

Page 48: 4-Traditional Internet Applications

SMTP (simple mail transfer protocol)

• Uses commands and responses to transfer messages. Each command or reply is terminated by carriage return and linefeed.

Page 49: 4-Traditional Internet Applications

20.3 MESSAGE TRANSFER AGENT: SMTP

The actual mail transfer requires message transfer agents (MTAs). The The actual mail transfer requires message transfer agents (MTAs). The protocol that defines the MTA client and server in the Internet is called protocol that defines the MTA client and server in the Internet is called Simple Mail Transfer Protocol (SMTP).Simple Mail Transfer Protocol (SMTP).

The topics discussed in this section include:The topics discussed in this section include:

Commands and Responses Commands and Responses Mail Transfer Phases Mail Transfer Phases

Page 50: 4-Traditional Internet Applications

Figure 20.13 SMTP range

Page 51: 4-Traditional Internet Applications

Figure 20.14 Commands and responses

Page 52: 4-Traditional Internet Applications

Figure 20.15 Command format

Page 53: 4-Traditional Internet Applications

Table 20.4 Table 20.4 CommandsCommands

Page 54: 4-Traditional Internet Applications

Table 20.5 Table 20.5 ResponsesResponses

Page 55: 4-Traditional Internet Applications

Table 20.5 Table 20.5 Responses (Continued)Responses (Continued)

Page 56: 4-Traditional Internet Applications

Figure 20.16 Connection establishment

Page 57: 4-Traditional Internet Applications

Figure 20.17 Message transfer

Page 58: 4-Traditional Internet Applications

Figure 20.18 Connection termination

Page 59: 4-Traditional Internet Applications

Example 1

$ telnet mail.adelphia.net 25Trying 68.168.78.100...Connected to mail.adelphia.net (68.168.78.100).

Let us see how we can directly use SMTP to send an email and simulate the commands and responses we described in this section. We use TELNET to log into port 25 (the well-known port for SMTP). We then use the commands directly to send an email. In this example, [email protected] is sending an email to himself. The first few lines show TELNET trying to connect to the adelphia mail server.

After connection, we can type the SMTP commands and then receive the responses as shown below. We have shown the commands in black and the responses in color. Note that we have added for clarification some comment lines, designated by the “=” sign. These lines are not part of the email procedure.

Page 60: 4-Traditional Internet Applications

Example 1 (Continued)

================== Connection Establishment ================220 mta13.adelphia.net SMTP server ready Fri, 6 Aug 2004 . . .

HELO mail.adelphia.net250 mta13.adelphia.net

===================== Envelope ===================MAIL FROM: [email protected]

250 Sender <[email protected]> OkRCPT TO: [email protected]

250 Recipient <[email protected]> Ok=================== Header and Body ==================DATA

354 Ok Send data ending with <CRLF>.<CRLF>From: ForouzanTO: Forouzan

This is a test messageto show SMTP in action..

Page 61: 4-Traditional Internet Applications

Example 1 (Continued)

============= Connection Termination===============

250 Message received: [email protected]

QUIT

221 mta13.adelphia.net SMTP server closing connection

Connection closed by foreign host.

Page 62: 4-Traditional Internet Applications

POP3 and IMAP4

• Message access protocols. (pull)

• Post Office protocol. Simple with limited functionality. Uses port 100. Has to modes, delete or keep.

• Internet Mail Access Protocol is used to check mail directly from the web.

Page 63: 4-Traditional Internet Applications

20.4 MESSAGE ACCESS AGENT: POP AND IMAP

The third stage of mail delivery uses a message access agent; the client The third stage of mail delivery uses a message access agent; the client must pull messages from the server. Currently two message access must pull messages from the server. Currently two message access protocols are available: Post Office Protocol, version 3 (POP3) and protocols are available: Post Office Protocol, version 3 (POP3) and Internet Mail Access Protocol, version 4.Internet Mail Access Protocol, version 4.

The topics discussed in this section include:The topics discussed in this section include:

POP3 POP3 IMAP4 IMAP4

Page 64: 4-Traditional Internet Applications

Figure 20.19 POP3 and IMAP4

Page 65: 4-Traditional Internet Applications

Figure 20.20 POP3

Page 66: 4-Traditional Internet Applications

20.5 WEB-BASED MAIL

Some websites such as Hotmail and Yahoo provide email service to Some websites such as Hotmail and Yahoo provide email service to anyone who accesses the site. Mail transfer and retrieval requires the use anyone who accesses the site. Mail transfer and retrieval requires the use of HTTP. of HTTP.

Page 67: 4-Traditional Internet Applications

DNS (Domain Name Server)

• Maps human readable symbolic names to computer addresses

• Domain names are hierarchical with most significant part of the name on the right. Root is a dot.

• Software that performs the address resolution is known as the resolver. The resolver holds one or more DNS addresses.

Page 68: 4-Traditional Internet Applications

Types of DNS entries

• Each DNS entry consists of three items: a domain name, a record type and a value.

• The record type: IP address ( A type, to be used with FTP, ping, browser etc), MX (for mail exchanger), NS (main machine incharge of the domain zone), etc.

Page 69: 4-Traditional Internet Applications

DNS autonomy

• Each organization is allowed to assign names to computers or change those names without informing a central authority.

• Each organization is permitted to operate DNS servers for its parts of the hierarchy.

• A given DNS can be replicated.

Page 70: 4-Traditional Internet Applications

Figure 17.7 DNS used in the Internet

Page 71: 4-Traditional Internet Applications

Figure 17.8 Generic domains

Page 72: 4-Traditional Internet Applications

Table 17.1 Table 17.1 Generic domain labelsGeneric domain labels

Page 73: 4-Traditional Internet Applications

Table 17.1 Table 17.1 Generic domain labels (Continued)Generic domain labels (Continued)

Page 74: 4-Traditional Internet Applications

Figure 17.9 Country domains

Page 75: 4-Traditional Internet Applications

Figure 17.10 Inverse domain

Page 76: 4-Traditional Internet Applications

17.5 RESOLUTION

Mapping a name to an address or an address to a name is called name-Mapping a name to an address or an address to a name is called name-address resolution.address resolution.

The topics discussed in this section include:The topics discussed in this section include:

Resolver Resolver Mapping Names to Addresses Mapping Names to Addresses Mapping Addresses to Names Mapping Addresses to Names Recursive Resolution Recursive Resolution Iterative Resolution Iterative Resolution Caching Caching

Page 77: 4-Traditional Internet Applications

Figure 17.11 Recursive resolution

Page 78: 4-Traditional Internet Applications

Figure 17.12 Iterative resolution

Page 79: 4-Traditional Internet Applications

DNS Caching

• To exploit temporal locality (repeated requests) DNS server caches all lookups. Cache timeouts cleans the items.

Page 80: 4-Traditional Internet Applications

The following will be assigned as labs later

• Install a mailserver in Unix or Windows (needs to be 2003)

• Install A mail client. Learn how to backup and restore outlook

• Learn how work with add-ins.

• Learn how to change MX records