140 likes | 154 Views
TASHKENT UNIVERSITY OF INFORMATION TECHNOLOGIES. THE DEPARTMENT OF DATA COMMUNICATION NETWORKS AND SYSTEMS. Lesson №12 Telecommunication network software design for HTTP and Internet. Lector: Aliev H.U. HTTP and Internet. Intro.
E N D
TASHKENT UNIVERSITY OF INFORMATION TECHNOLOGIES THE DEPARTMENT OF DATA COMMUNICATION NETWORKS AND SYSTEMS Lesson №12Telecommunication network software design for HTTP and Internet Lector: Aliev H.U.
Intro • With the advent of the World Wide Web, there has been a massive increase in the usage of the Internet since 1990. This was made possible with the advent of HyperText Transport Protocol (HTTP). Tim Berners-Lee first implemented the HTTP protocol in 1990-91 at CERN, the European Center for High-Energy Physics in Geneva, Switzerland. • HTTP is a lightweight application-level protocol that sits on top of TCP, and it is of course known chiefly as the transport channel of the World Wide Web, and local intranets. However, it is a generic protocol that is used for many other tasks as well as hypertext, such as for name servers and distributed object management systems through its request methods, error codes, and headers. HTTP messages are in a MIME-like format, and contain meta data about the message (such as the type of content it contains and its length), and information about the request and response, such as the method used to send the request. • There are two essential components on which the Web depends-the TCP/IP network protocol and HTTP. Almost everything that happens on the Web happens over HTTP, and the HTTP protocol is mainly used for exchanging documents (such as web pages) in the World Wide Web. • HTTP is a client-server protocol through which two systems communicate, usually over a TCP/IP connection. An HTTP server is a program that listens on a port on the machine for incoming HTTP requests. • An HTTP client opens a connection to the server through a socket, sends a request message for a particular document, and waits for a reply from the server. The server sends a response message containing a success or error code, headers containing information about the response, and (if the request was successful) the requested document.
Internet software design Client side web browser Web server software
HTTP in .NET • Although we can implement the HTTP protocol manually using the standard Sockets or TCP classes, .NET provides a number of classes (mostly in the System.Net namespace) that are designed to facilitate communication with an HTTP server. These implement the generic request/response model, along with some of the additional properties that provide a greater level of control over the HTTP-specific features, such as access to the HTTP protocol in an object model for property-level control over headers, authentication, pre-authentication, encryption, proxy support, pipelining, and connection management:
HttpWebRequest and HttpWeb Response application example • The .NET Framework provides two basic classes for simplifying HTTP access: HttpWebRequest and HttpWebResponse. These classes handle most of the functionality provided through the HTTP protocol in a straightforward manner. • To see how these classes work, let's look at an example of using them to retrieve a web page from the Internet: • using System; • using System.Net; • using System.IO; • using System.Text; • class SimpleWebRequest • { public static void Main() • { string query = "http://www.wrox.com"; • HttpWebRequestreq = (HttpWebRequest)HttpWebRequest.Create(query); HttpWebResponseresp = (HttpWebResponse)req.GetResponse(); • StreamReadersr = new StreamReader(resp.GetResponseStream, Encoding.ASCII); Console.WriteLine(sr.ReadToEnd); • resp.Close(); • sr.Close(); } }
Languages for HTTP Server and client side programming • For web page: HTML, Java script, Ajax, python and other interpreter languages; • For server and client network applications: C++, C#, Java, Visual basic, J# and others. • For data bases: SQL, PL-SQL.
Conclusion • The first step in Internet programming is to have a good knowledge of how HTTP works, so we started the chapter by giving an overview of the HTTP protocol, before looking at the support for HTTP programming in .NET. This lesson basically concentrated on: • An overview of HTTP-the basics of HTTP, its properties and features, and HTTP requests and responses • Using the .NET methods and classes to work with the HTTP protocol • Reading and writing cookies in .NET • Creating an HTTP server and client in .NET, and hosting ASP.NET apps outside US • Using the HTTP channel with .NET Remoting