亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch19.htm

?? Learning language of Visual C++6
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<P>GOPHER_TYPE_PDF</P>
<P>GOPHER_TYPE_CALENDAR</P>
<P>GOPHER_TYPE_INLINE</P>
<P>GOPHER_TYPE_UNKNOWN</P>
<P>GOPHER_TYPE_ASK</P>
<P>GOPHER_TYPE_GOPHER_PLUS</P>
<P>Normally, you don't build locators for files or directories; instead, you ask
the server for them. The locator that will be returned from this call to CreateLocator()
describes the locator associated with the site you are investigating.</P>
<P>Add a pair of lines at the end of OnQuery() that call this new TryGopherSite()
function:</P>
<P>
<PRE>     TryGopherSite(m_host);
     TryGopherSite(&quot;gopher.&quot; + m_host);
</PRE>
<P>Build and run the program again. Again, you might have to wait several minutes
for the results. Figure 19.10 shows that Query has found two Gopher sites for <B>harvard.edu</B>.
In both cases, the locator describes the site itself. This is enough to prove that
there is a Gopher site at <B>harvard.edu</B>, which is all that Query is supposed
to do.</P>
<P><A HREF="javascript:popUp('19uvc10.gif')"><B>FIG. 19.10</B></A><B> </B><I>Query
finds two Harvard Gopher sites.</I></P>
<P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>TIP:</strong> Gopher is an older protocol that has been supplanted almost entirely
	by the World Wide Web. As a general rule, if a site has a Gopher presence, it's been
	on the Internet since before the World Wide Web existed (1989) or at least before
	the huge upsurge in popularity began (1992). What's more, the site was probably large
	enough in the early 1990s to have an administrator who would set up the Gopher menus
	and text. 
<HR>


</BLOCKQUOTE>

<H2><A NAME="Heading6"></A>Using Gopher to Send a Finger Query</H2>
<P>There is another protocol that can give you information about a site. It's one
of the oldest protocols on the Internet, and it's called <I>Finger</I>. You can finger
a single user or an entire site, and though many sites have disabled Finger, many
more will provide you with useful information in response to a Finger request.</P>
<P>There is no MFC class or API function with the word <I>finger</I> in its name,
but that doesn't mean you can't use the classes already presented. This section relies
on a trick--and on knowledge of the Finger and Gopher protocols. Although the WinInet
classes are a boon to new Internet programmers who don't quite know how the Internet
works, they also have a lot to offer to old-timers who know what's going on under
the hood.</P>
<P>As discussed in the &quot;Using Windows Sockets&quot; section of Chapter 18, all
Internet transactions involve a host and a port. Well-known services use standard
port numbers. For example, when you call CInternetSession::OpenURL() with an URL
that begins with <B>http://</B>, the code behind the scenes connects to port 80 on
the remote host. When you call GetFtpConnection(), the connection is made to port
21 on the remote host. Gopher uses port 70. If you look at Figure 19.10, you'll see
that the locator that describes the <B>gopher.harvard.edu</B> site includes a mention
of port 70.</P>
<P>The Gopher documentation makes this clear: If you build a locator with a host
name, port 70, Gopher type 0 (GOPHER_TYPE_TEXT_FILE is defined to be 0), and a string
with a filename, any Gopher client simply sends the string, whether it's a filename
or not, to port 70. The Gopher server listening on that port responds by sending
the file.</P>
<P>Finger is a simple protocol, too. If you send a string to port 79 on a remote
host, the Finger server that is listening there will react to the string by sending
a Finger reply. If the string is only \r\n, the usual reply is a list of all the
users on the host and some other information about them, such as their real names.
(Many sites consider this an invasion of privacy or a security risk, and they disable
Finger. Many other sites, though, deliberately make this same information available
on their Web pages.)</P>
<P>Putting this all together, if you build a Gopher locator using port 79--instead
of the default 70--and an empty filename, you can do a Finger query using the MFC
WinInet classes. First, add another function to CQueryDlg called TryFinger(), which
takes a CString host and returns void. The code for this function is very much like
TryGopherSite(), except that the connection is made to port 79:</P>
<P>
<PRE>          connection = session.GetGopherConnection(host,NULL,NULL,79);
</PRE>
<P>After the connection is made, a text file locator is created:</P>
<P>
<PRE>          CGopherLocator locator = connection-&gt;CreateLocator(NULL, NULL, 
              GOPHER_TYPE_TEXT_FILE);
</PRE>
<P>This time, rather than simply cast the locator into a CString, use it to open
a file:</P>
<P>
<PRE>          CGopherFile* file = connection-&gt;OpenFile(locator);
</PRE>
<P>Then echo the first 20 lines of this file, just as TryURL() echoed the first 20
lines of the file returned by a Web server. The code for this is in Listing 19.7.</P>
<P>
<H4>Listing 19.7&#160;&#160;QueryDlg.cpp--CQueryDlg::TryFinger() Excerpt</H4>
<PRE>          if (file)
          {
               CString line;
               for (int i=0; i &lt; 20 &amp;&amp; file-&gt;ReadString(line); i++)
               {
                    m_out += line + &quot;\r\n&quot;;
               }
               file-&gt;Close();
               delete file;
</PRE>
<PRE>          }
</PRE>
<P>Putting it all together, Listing 19.8 shows TryFinger().</P>
<P>
<H4>Listing 19.8&#160;&#160;QueryDlg.cpp--CQueryDlg::TryFinger()</H4>
<PRE>void CQueryDlg::TryFinger(CString host)
{
     CInternetSession session;
     m_out += &quot;Trying to Finger &quot; + host + &quot;\r\n&quot;;
     UpdateData(FALSE);
     CGopherConnection* connection = NULL;
     try
     {
          connection = session.GetGopherConnection(host,NULL,NULL,79);
     }
     catch (CInternetException* pEx)
     {
          //if anything went wrong, just set connection to NULL
          connection = NULL;
          pEx-&gt;Delete();
     }
     if (connection)
     {
          m_out += &quot;Connection established. \r\n&quot;;
          CGopherLocator locator = connection-&gt;CreateLocator(NULL, NULL, 
                GOPHER_TYPE_TEXT_FILE);
          CGopherFile* file = connection-&gt;OpenFile(locator);
          if (file)
          {
               CString line;
               for (int i=0; i &lt; 20 &amp;&amp; file-&gt;ReadString(line); i++)
               {
                    m_out += line + &quot;\r\n&quot;;
               }
               file-&gt;Close();
               delete file;
          }
          connection-&gt;Close();
          delete connection;
     }
     else
     {
          m_out += &quot;No server found there. \r\n&quot;;
     }
     m_out += &quot;------------------------\r\n&quot;;
     UpdateData(FALSE);
</PRE>
<PRE>}
</PRE>
<P>Add a line at the end of OnQuery() that calls this new function:</P>
<P>
<PRE>     TryFinger(m_host);
</PRE>
<P>Now, build and run the application. Figure 19.11 shows the result of a query on
the site <B>whitehouse.gov</B>, scrolled down to the Finger section.</P>
<P><A HREF="javascript:popUp('19uvc11.gif')"><B>FIG. 19.11</B></A><B> </B><I>Query
gets email addresses from the White House Finger server.</I></P>
<P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>NOTE:</strong> If the site you are investigating isn't running a Finger server,
	the delay will be longer than usual and a message box will appear, telling you the
	connection timed out. Click OK on the message box if it appears.[dagger]n 
<HR>


</BLOCKQUOTE>

<H2><A NAME="Heading7"></A>Using Gopher to Send a Whois Query</H2>
<P>One last protocol provides information about sites. It, too, is an old protocol
not supported directly by the WinInet classes. It is called <I>Whois</I>, and it's
a service offered by only a few servers on the whole Internet. The servers that offer
this service are maintained by the organizations that register domain names. For
example, domain names that end in <B>.com</B> are registered through an organization
called InterNIC, and it runs a Whois server called <B>rs.internic.net</B> (the <I>rs</I>
stands for Registration Services.) Like Finger, Whois responds to a string sent on
its own port; the Whois port is 43. Unlike Finger, you don't send an empty string
in the locator; you send the name of the host that you want to look up. You connect
to <B>rs.internic.net</B> every time. (Dedicated Whois servers offer users a chance
to change this, but in practice, no one ever does.)</P>
<P>Add a function called TryWhois(); as usual, it takes a CString host and returns
void. The code is in Listing 19.9.</P>
<P>
<H4>Listing 19.9&#160;&#160;QueryDlg.cpp--CQueryDlg::TryWhois()</H4>
<PRE>void CQueryDlg::TryWhois(CString host)
{
     CInternetSession session;
     m_out += &quot;Trying Whois for &quot; + host + &quot;\r\n&quot;;
     UpdateData(FALSE);
     CGopherConnection* connection = NULL;
     try
     {
          connection = session.GetGopherConnection                   &#172;(&quot;rs.internic.net&quot;,NULL,NULL,43);
     }
     catch (CInternetException* pEx)
     {
          //if anything went wrong, just set connection to NULL
          connection = NULL;
          pEx-&gt;Delete();
     }
     if (connection)
     {
          m_out += &quot;Connection established. \r\n&quot;;
          CGopherLocator locator = connection-&gt;CreateLocator(NULL, host, 
               GOPHER_TYPE_TEXT_FILE);
          CGopherFile* file = connection-&gt;OpenFile(locator);
          if (file)
          {
               CString line;
               for (int i=0; i &lt; 20 &amp;&amp; file-&gt;ReadString(line); i++)
               {
                    m_out += line + &quot;\r\n&quot;;
               }
               file-&gt;Close();
               delete file;
          }
          connection-&gt;Close();
          delete connection;
     }
     else
     {
          m_out += &quot;No server found there. \r\n&quot;;
     }
     m_out += &quot;------------------------\r\n&quot;;
     UpdateData(FALSE);
</PRE>
<PRE>}
</PRE>
<P>Add a line at the end of OnQuery() to call it:</P>
<P>
<PRE>     TryWhois(m_host);
</PRE>
<P>Build and run the application one last time. Figure 19.12 shows the Whois part
of the report for <B>mcp.com</B>--this is the domain for Macmillan Computer Publishing,
Que's parent company.</P>
<P><A HREF="javascript:popUp('19uvc12.gif')"><B>FIG. 19.12</B></A><B> </B><I>Query
gets real-life addresses and names from the InterNIC Whois server.</I></P>
<P>Adding code after the Finger portion of this application means that you can no
longer ignore the times when the Finger code can't connect. When the call to OpenFile()
in TryFinger() tries to open a file on a host that isn't running a Finger server,
an exception is thrown. Control will not return to OnQuery(), and TryWhois() will
never be called. To prevent this, you must wrap the call to OpenFile() in a try and
catch block. Listing 19.10 shows the changes to make.</P>
<P>
<H4>Listing 19.10&#160;&#160;QueryDlg.cpp&#160;&#160;Changes to TryFinger()</H4>
<PRE>//replace this line:
          CGopherFile* file = connection-&gt;OpenFile(locator);
//with these lines:
          CGopherFile* file = NULL;
          try
          {
               file = connection-&gt;OpenFile(locator);
          }
          catch (CInternetException* pEx)
          {
               //if anything went wrong, just set file to NULL
               file = NULL;
               pEx-&gt;Delete();
</PRE>
<PRE>          }
</PRE>
<P>Change TryFinger(), build Query again, and query a site that doesn't run a Finger
server, such as <B>microsoft.com</B>. You will successfully reach the Whois portion
of the application.</P>
<P>
<H2><A NAME="Heading8"></A>Future Work</H2>
<P>The Query application built in this chapter does a lot, but it could do much more.
There are email and news protocols that could be reached by stretching the WinInet
classes a little more and using them to connect to the standard ports for these other
services. You could also connect to some well-known Web search engines and submit
queries by forming URLs according to the pattern used by those engines. In this way,
you could automate the sort of poking around on the Internet that most of us do when
we're curious about a domain name or an organization.</P>
<P>If you'd like to learn more about Internet protocols, port numbers, and what's
happening when a client connects to a server, you might want to read Que's <I>Building
Internet Applications with Visual C++.</I> The book was written for Visual C++ 2.0,
and though all the applications in the book compile and run under later versions
of MFC, the applications would be much shorter and easier to write now. Still, the
insight into the way the protocols work is valuable.</P>
<P>The WinInet classes, too, can do much more than you've seen here. Query doesn't
use them to retrieve real files over the Internet. Two of the WinInet sample applications
included with Visual C++ 6.0 do a fine job of showing how to retrieve files:</P>

<UL>
	<LI>FTPTREE builds a tree list of the files and directories on an FTP site.
	<P>
	<LI>TEAR brings back a page of HTML from a Web site.
</UL>

<P>There are a lot more Microsoft announcements to come in the next few months. Keep
an eye on the Web site <B>www.microsoft.com</B> for libraries and software development
kits that will make Internet software development even easier and faster.</P>
<H1></H1>
<CENTER>
<P>
<HR>
<A HREF="../ch18/ch18.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch20/ch20.htm"><IMG
SRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <BR>
</P>

<P>&#169; <A HREF="../copy.htm">Copyright</A>, Macmillan Computer Publishing. All
rights reserved.
</CENTER>


</BODY>

</HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美精品在线观看| 国产清纯白嫩初高生在线观看91 | 国产婷婷色一区二区三区| 国产在线国偷精品产拍免费yy| 亚洲嫩草精品久久| 日韩一级片网站| 午夜激情综合网| 欧美精品乱码久久久久久按摩| 2023国产精品| 久久国产精品99久久久久久老狼 | 日韩久久久久久| 韩国精品主播一区二区在线观看| 中文天堂在线一区| 欧美日本一区二区三区四区| 国产精品一线二线三线精华| 亚洲另类中文字| 久久一区二区视频| 色综合天天综合色综合av| 久久精品国产亚洲aⅴ| 亚洲色图都市小说| 精品国产一区久久| 欧美亚洲高清一区| 成人美女视频在线看| 另类调教123区| 最新久久zyz资源站| 久久综合九色综合欧美98| 欧洲一区在线电影| 岛国一区二区在线观看| 日本vs亚洲vs韩国一区三区二区| 亚洲欧洲精品一区二区精品久久久 | 亚洲国产中文字幕在线视频综合| 日本一区二区三区四区| 日韩免费在线观看| 91麻豆精品国产91久久久更新时间| av色综合久久天堂av综合| 国产jizzjizz一区二区| 理论电影国产精品| 天天综合日日夜夜精品| 亚洲一区二区三区三| 国产农村妇女精品| 国产目拍亚洲精品99久久精品| 精品欧美一区二区久久| 91 com成人网| 日韩女优制服丝袜电影| 亚洲欧洲国产日本综合| 国产清纯白嫩初高生在线观看91 | 国产成人99久久亚洲综合精品| 蜜臀av国产精品久久久久| 日韩av不卡一区二区| 喷水一区二区三区| 麻豆久久一区二区| 九九**精品视频免费播放| 美女视频免费一区| 极品美女销魂一区二区三区| 国产麻豆精品theporn| 国产成人精品综合在线观看 | 毛片不卡一区二区| 国内久久婷婷综合| 成人性生交大合| 91国产免费观看| 欧美日韩国产系列| wwwwww.欧美系列| 国产精品视频第一区| 亚洲精品国产视频| 日韩成人av影视| 国产成人h网站| 色悠悠亚洲一区二区| 欧美一区二区三区播放老司机| 精品国产三级a在线观看| 国产精品久久久久aaaa| 全部av―极品视觉盛宴亚洲| 国产99久久久国产精品潘金| 欧美在线你懂的| 久久中文娱乐网| 亚洲福利一区二区三区| 国产乱码精品一区二区三区av| 色又黄又爽网站www久久| 欧美成人在线直播| 亚洲精品成a人| 国产麻豆精品theporn| 欧美午夜片在线看| 国产无人区一区二区三区| 亚洲国产成人tv| av在线不卡观看免费观看| 日韩欧美精品三级| 亚洲欧美日韩国产手机在线| 精品制服美女丁香| 欧美三级三级三级| 成人欧美一区二区三区| 久久精品999| 欧美顶级少妇做爰| 亚洲精品国产一区二区精华液 | caoporn国产精品| 91精品国产全国免费观看| 一区二区三区日本| a在线播放不卡| 国产亚洲综合av| 精品在线亚洲视频| 日韩精品最新网址| 日韩电影在线观看一区| 欧美性猛交xxxx黑人交| 综合网在线视频| 99视频在线精品| 国产精品乱码久久久久久| 国产一区二区视频在线播放| 精品免费国产二区三区| 免费国产亚洲视频| 9191国产精品| 亚洲伊人色欲综合网| 在线精品视频一区二区三四| 亚洲欧美日韩国产手机在线| 99久久精品国产一区| 亚洲免费av网站| 欧美中文字幕久久| 一区二区三区在线高清| 欧美色综合影院| 秋霞影院一区二区| 精品国产免费久久| 国产91精品久久久久久久网曝门 | 成人黄色小视频在线观看| 国产精品你懂的在线欣赏| 91在线porny国产在线看| 亚洲激情欧美激情| 欧美丰满少妇xxxxx高潮对白| 日韩高清一区在线| 久久久亚洲精品石原莉奈| 成人av网站免费观看| 亚洲一区在线观看网站| 欧美福利视频导航| 国产麻豆精品久久一二三| 亚洲欧洲av在线| 成人av免费网站| 天堂资源在线中文精品| 26uuuu精品一区二区| aa级大片欧美| 亚洲电影你懂得| 91精品国产一区二区人妖| 国产精品77777竹菊影视小说| 玉米视频成人免费看| 精品国产制服丝袜高跟| 91原创在线视频| 久久狠狠亚洲综合| 一区二区三区精品久久久| 精品福利一区二区三区免费视频| 色偷偷88欧美精品久久久| 毛片不卡一区二区| 亚洲综合激情小说| 国产欧美日韩在线视频| 欧美男人的天堂一二区| 91香蕉视频污在线| 国产91精品久久久久久久网曝门| 日韩中文字幕不卡| 亚洲午夜久久久久中文字幕久| 国产精品无码永久免费888| 日韩欧美国产精品| 欧美精品自拍偷拍动漫精品| 色老综合老女人久久久| 成人午夜碰碰视频| 国产精品资源在线看| 久久国产麻豆精品| 美女精品一区二区| 一区二区高清免费观看影视大全| 国产精品沙发午睡系列990531| 日韩欧美第一区| 欧美一区二区三区四区五区| 欧美日韩在线一区二区| 在线亚洲免费视频| 成人性生交大片免费看中文| 国产成人丝袜美腿| 丁香天五香天堂综合| 国产成人免费在线| 东方欧美亚洲色图在线| 大尺度一区二区| 99国产精品久久久| 91麻豆国产在线观看| 色一情一伦一子一伦一区| 91成人在线精品| 欧美欧美午夜aⅴ在线观看| 欧美剧情电影在线观看完整版免费励志电影 | 99国产精品久久久久久久久久| 99国内精品久久| 欧美日韩一区高清| 日韩午夜精品电影| 欧美激情一区二区三区在线| 中文字幕在线观看一区| 亚洲国产精品视频| 男女男精品网站| 成人深夜福利app| 欧美性xxxxxxxx| 精品久久久久久久久久久院品网| 久久久亚洲高清| 亚洲精品videosex极品| 免费观看日韩电影| 亚洲成a天堂v人片| 国产精品18久久久久久久久| 成人国产精品免费网站| 欧美精品色一区二区三区| 久久久久久久久岛国免费| 怡红院av一区二区三区| 激情欧美一区二区三区在线观看|