... | @@ -41,6 +41,7 @@ |
... | @@ -41,6 +41,7 @@ |
|
* [7-4 System.Net.Dns](#dns)
|
|
* [7-4 System.Net.Dns](#dns)
|
|
* [7-5 System.Net.Sockets.Socket](#socket)
|
|
* [7-5 System.Net.Sockets.Socket](#socket)
|
|
* [7-6 System.Net.HttpWebRequest](#httpwebrequest)
|
|
* [7-6 System.Net.HttpWebRequest](#httpwebrequest)
|
|
|
|
* [7-7 System.Net.WebClient](#webclient)
|
|
|
|
|
|
-- -- --
|
|
-- -- --
|
|
|
|
|
... | @@ -2255,4 +2256,30 @@ class HttpWebRequestEx |
... | @@ -2255,4 +2256,30 @@ class HttpWebRequestEx |
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
``` |
|
```
|
|
\ No newline at end of file |
|
|
|
|
|
### WebClient
|
|
|
|
|
|
|
|
```c#
|
|
|
|
class HttpWebClientEx
|
|
|
|
{
|
|
|
|
public static void Main()
|
|
|
|
{
|
|
|
|
ClientFunc();
|
|
|
|
|
|
|
|
Console.WriteLine("종료하려면 아무 키나 누르세요...");
|
|
|
|
Console.ReadLine();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ClientFunc()
|
|
|
|
{
|
|
|
|
//WebClient 타입은 내부적으로 httpWebRequest를 이용해 통신한다.
|
|
|
|
WebClient wc = new WebClient();
|
|
|
|
|
|
|
|
//입력한 Url에서 받아온 데이터를 인코딩만 해서 출력하면 끝.
|
|
|
|
string responseText = Encoding.UTF8.GetString(wc.DownloadData("http://www.naver.com"));
|
|
|
|
|
|
|
|
Console.WriteLine(responseText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
``` |