.


:




:

































 

 

 

 


Using System.Net; using System.10;




class NetDemo {

static void Main() { int ch;

// WebRequest URI. HttpWebRequest req = (HttpWebRequest)

WebRequest.Create(" http://www.McGraw-Hill.com ");

// . HttpWebResponse resp = (HttpWebResponse) req.GetResponse();

// .

Stream istrm = resp.GetResponseStream();

/* ,

URI. 400 . <ENTER>, 400 . */ for (int i=l;; i++) { ch = istrm.ReadByte(); if(ch == -1) break;

Console.Write ((char) ch); if((i % 4 0 0)==0) {

Console.Write (" <Enter>.");

Console.ReadLine();

}

}

// . istrm. resp.Close();

}

}

. (, -, .)

<html>

<head>

<title>Home - The McGraw-Hill Companies</title>

<meta name="keywords" content="McGraw-Hill Companies,McGraw-Hill, McGraw Hill, Aviation Week, BusinessWeek, Standard and Poor's, Standard & Poor1s,CTB/McGraw-Hill,Glencoe/McGraw-Hill, The Grow Network/McGraw-Hill,Macmillan/McGraw-Hill, McGraw-Hill Contemporary,McGraw-Hill Digital Learning,McGraw-Hill Professional Development,SRA/McGraw

<Enter>.

-Hill,Wright Group/McGraw-Hill,McGraw-Hill Higher Education,McGraw-Hill/Irwin, McGraw-Hill/Primis Custom Publishing,McGraw-Hill/Ryerson,Tata/McGraw-Hill,

McGraw-Hill Interamericana,Open University Press, Healthcare Information Group, Platts, McGraw-Hill Construction, Information & Media Services" />

<meta name="description" content="The McGraw-Hill Companies Corporate Website." /> <meta http-equiv

<Enter>. 1

, , McGraw-Hill www.McGraw-Hill. com. , .

. System. Net. , . , System. 10, , - , Stream.

WebRequest, URL , Create (), . WebRequest. WebRequest , . Create () HttpWebRequest. , HttpWebRequest, req HttpWebRequest. , URL

, GetResponse () WebRequest. , GetResponse () . , GetResponse () WebResponse, . resp. HTTP, HttpWebResponse. , URL

GetResponseStream () resp. Stream , . istrm, URI, .

- McGraw-Hill www.McGraw-Hill. com . , 400 , <Enter>, . . , ReadByte (). , int, char. - 1.

, Close () resp. . . , .

: , , HttpWebRequest HttpWebResponse. , WebRequest WebResponse, HTTP. , Create () GetResponse () .

// WebRequest URI.

WebRequest req = WebRequest.Create(" http://www.McGraw-Hill.com ");

// .

WebResponse resp = req.GetResponse();

, , WebRequest WebResponse, , . , , HTTP, HttpWebRequest HttpWebResponse.

, , . , , , , . , , Create (), GetResponse () GetResponseStream (). , . , HTTP, , #, .

, Create ()

Create (), WebRequest, . , , URI, , NotSupportedException. URI , UriFormatException. , System. Security. SecurityException. , Create () ArgumentNullException, , .

, GetResponse ()

GetResponse () HTTP . : InvalidOperationException, ProtocolViolationException, NotSupportedException WebException. WebException.

WebException , : Response Status. Response WebResponse . HTTP . Response .

public WebResponse Response { get; }

, Status WebException , . :

public WebExceptionStatus Status {get; }





:


: 2016-12-03; !; : 358 |


:

:

, .
==> ...

1786 - | 1593 -


© 2015-2024 lektsii.org - -

: 0.009 .