1 / 13

Implementing Application Protocols

Implementing Application Protocols Overview An application protocol facilitates communication between applications. For example, an email client uses an application protocol to communicate with the server to retrieve messages.

Télécharger la présentation

Implementing Application Protocols

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Implementing Application Protocols

  2. Overview • An application protocol facilitates communication between applications. For example, an email client uses an application protocol to communicate with the server to retrieve messages. • For applications to interoperate, the implementation of application protocols must be precise.

  3. The semantics of a protocol are laid out in a protocol specification document. • Most of the popular Internet protocols are published as Request For Comment (RFC) documents. These documents can be accessed through http://www.rfc-editor.org/rfc.html. • Each RFC document details a single protocol or idea about the Internet, and is assigned a number for identification. For example, RFC 1945 concerns HTTP/1.0.

  4. An SMTP Client Implementation • The Simple Mail Transfer Protocol (SMTP) is used to send messages of various types between users over a TCP/IP network. • The example we will look at is a basic SMTP client that allows the user to send a text message to a specific email address.

  5. Program Outline • Get input from user • get SMTP server hostname • get sender's email address • get recipient's email address • get email subject • get email body (terminated with a '.' on a blank line)

  6. Send the email • L1: create socket (open connection) • create reader and writer • the writer will be used for sending data to the server • the reader will be used for reading response from server • check response code for L1 (220) • L2: send identification message • check response code for L2 (250) • L3: send sender's email address • check response code for L3 (250)

  7. L4: send recipient's email address • check response code for L4 (250) • L5: send data command • check response code for L5 (354) • L6: send email message • check response code for L6 (250) • send quit command • close connection

  8. A POP3 Client Implementation • POP3 is a protocol for fetching mail from a mail server. • The example we will look at is a simple POP3 client which retrieves messages from a mailbox and displays their contents, one after another, to the text console screen.

  9. Program Outline • Get input from user • get POP3 server hostname • get mailbox username • get mailbox password • Fetch and display email • L1: create socket (open connection) • create reader and writer • the writer will be used for sending data to the server • the reader will be used for reading response from server

  10. check response for L1 • L2: send user name • check response for L2 • L3: send password • check response for L3 • L4: send STAT command • get number of messages from response for L4 • For each message • send RETR command • read and display message contents line by line (terminated with a '.' on a blank line) • send quit command • close connection

  11. HTTP/1.0 Server Implementation • The Hypertext Transfer Protocol (HTTP) originated as a means of sharing documents across the Internet. • Through hyperlinks, HTTP allows one to jump instantly from one document to another, even though the documents could reside on servers located in other countries. • Hyperlinks could also be made within the same document.

  12. Published as RFC 1945, HTTP became one of the most quickly adopted protocols, and led to the World Wide Web. • The first, and most widely supported version, of HTTP is known as HTTP/1.0. • This protocol supports a simple set of commands for retrieving resources from a Web server, such as HTML pages, images, documents and other file types. • It also supports commads for posting information to the Web server so as to allow for the interactivity and customization of Web pages.

  13. The latest version of the protocol is HTTP/1.1. It offers many improvements and has a wider set of commands. However, not all browsers and servers support this protocol. • For this lab, we will look at how to write a multi-threaded HTTP server that responds to requests from a Web server, fetches files or Web pages, and sends them back to the user. Note that HTTP/1.0 is used and only the GET method is supported which is used for file retrieval.

More Related