﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-我住包子山-随笔分类-MSDN Digest</title><link>http://www.cppblog.com/gohan/category/7401.html</link><description /><language>zh-cn</language><lastBuildDate>Thu, 19 Jun 2008 01:56:57 GMT</lastBuildDate><pubDate>Thu, 19 Jun 2008 01:56:57 GMT</pubDate><ttl>60</ttl><item><title>[MFC]建立典型HTTP Client应用程序的步骤</title><link>http://www.cppblog.com/gohan/archive/2008/06/19/53963.html</link><dc:creator>Gohan</dc:creator><author>Gohan</author><pubDate>Thu, 19 Jun 2008 01:19:00 GMT</pubDate><guid>http://www.cppblog.com/gohan/archive/2008/06/19/53963.html</guid><wfw:comment>http://www.cppblog.com/gohan/comments/53963.html</wfw:comment><comments>http://www.cppblog.com/gohan/archive/2008/06/19/53963.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gohan/comments/commentRss/53963.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gohan/services/trackbacks/53963.html</trackback:ping><description><![CDATA[<div class="majorTitle">The following table shows the steps you might perform in a typical HTTP client application:</div>
<div id="mainSection">
<div id="mainBody">
<div class="seeAlsoNoToggleSection" id="sectionSection0">
<div class="labelheading"><strong></strong></div>
<div class="tableSection">
<table width="100%">
    <tbody>
        <tr>
            <th>Your goal </th> <th>Actions you take </th> <th>Effects </th>
        </tr>
        <tr>
            <td>
            <p>Begin an HTTP session.</p>
            </td>
            <td>
            <p>Create a <a id="ctl00_rs1_mainContentContainer_ctl01" href="http://msdn.microsoft.com/en-us/library/cttkhz64%28VS.80%29.aspx">CInternetSession</a> object.</p>
            </td>
            <td>
            <p>Initializes WinInet and connects to server.</p>
            </td>
        </tr>
        <tr>
            <td>
            <p>Connect to an HTTP server.</p>
            </td>
            <td>
            <p>Use <a id="ctl00_rs1_mainContentContainer_ctl02" href="http://msdn.microsoft.com/en-us/library/59kzsz14%28VS.80%29.aspx">CInternetSession::GetHttpConnection</a>.</p>
            </td>
            <td>
            <p>Returns a <a id="ctl00_rs1_mainContentContainer_ctl03" href="http://msdn.microsoft.com/en-us/library/0z6f3y99%28VS.80%29.aspx">CHttpConnection</a> object.</p>
            </td>
        </tr>
        <tr>
            <td>
            <p>Open an HTTP request.</p>
            </td>
            <td>
            <p>Use <a id="ctl00_rs1_mainContentContainer_ctl04" href="http://msdn.microsoft.com/en-us/library/b9zh7b56%28VS.80%29.aspx">CHttpConnection::OpenRequest</a>.</p>
            </td>
            <td>
            <p>Returns a <a id="ctl00_rs1_mainContentContainer_ctl05" href="http://msdn.microsoft.com/en-us/library/0tw8chfe%28VS.80%29.aspx">CHttpFile</a> object.</p>
            </td>
        </tr>
        <tr>
            <td>
            <p>Send an HTTP request.</p>
            </td>
            <td>
            <p>Use <a id="ctl00_rs1_mainContentContainer_ctl06" href="http://msdn.microsoft.com/en-us/library/x0sdt84e%28VS.80%29.aspx">CHttpFile::AddRequestHeaders</a> and <a id="ctl00_rs1_mainContentContainer_ctl07" href="http://msdn.microsoft.com/en-us/library/2xfbsd16%28VS.80%29.aspx">CHttpFile::SendRequest</a>.</p>
            </td>
            <td>
            <p>Finds the file. Returns FALSE if the file is not found.</p>
            </td>
        </tr>
        <tr>
            <td>
            <p>Read from the file.</p>
            </td>
            <td>
            <p>Use <a id="ctl00_rs1_mainContentContainer_ctl08" href="http://msdn.microsoft.com/en-us/library/0tw8chfe%28VS.80%29.aspx">CHttpFile</a>.</p>
            </td>
            <td>
            <p>Reads the specified number of bytes using a buffer you supply.</p>
            </td>
        </tr>
        <tr>
            <td>
            <p>Handle exceptions.</p>
            </td>
            <td>
            <p>Use the <a id="ctl00_rs1_mainContentContainer_ctl09" href="http://msdn.microsoft.com/en-us/library/ssz0z60x%28VS.80%29.aspx">CInternetException</a> class.</p>
            </td>
            <td>
            <p>Handles all common Internet exception types.</p>
            </td>
        </tr>
        <tr>
            <td>
            <p>End the HTTP session.</p>
            </td>
            <td>
            <p>Dispose of the <a id="ctl00_rs1_mainContentContainer_ctl10" href="http://msdn.microsoft.com/en-us/library/cttkhz64%28VS.80%29.aspx">CInternetSession</a> object.</p>
            </td>
            <td>
            <p>Automatically cleans up open file handles and connections.</p>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
</div>
</div>
<p align="right"><a href="http://msdn.microsoft.com/en-us/library/8yh4zs9e(VS.80).aspx" target="_blank">来源</a></p><img src ="http://www.cppblog.com/gohan/aggbug/53963.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gohan/" target="_blank">Gohan</a> 2008-06-19 09:19 <a href="http://www.cppblog.com/gohan/archive/2008/06/19/53963.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>