六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

構造.NET環境下的頁面下載器 (2)

[摘要]三.網頁下載器實例介紹:   最后,我就綜合以上.NET網絡編程的一些知識,向大家展示一個很好的實例。該實例是一個運用Socket的基于同步模式的客戶端應用程序,它首先通過解析服務器的IP地址建立一個終結點,同時創建一個基于流套接字的Socket連接,其運用的協議是TCP協議。通過該...
三.網頁下載器實例介紹: 
   
    最后,我就綜合以上.NET網絡編程的一些知識,向大家展示一個很好的實例。該實例是一個運用Socket的基于同步模式的客戶端應用程序,它首先通過解析服務器的IP地址建立一個終結點,同時創建一個基于流套接字的Socket連接,其運用的協議是TCP協議。通過該Socket就可以發送獲取網頁的命令,再通過該Socket獲得服務器上默認的網頁,最后通過文件流將獲得的數據寫入本機文件。這樣就完成了網頁的下載工作了,程序運行的效果如下所示: 
    
   
   
  程序的代碼如下: 
   
  using System; 
  using System.Drawing; 
  using System.Collections; 
  using System.ComponentModel; 
  using System.Windows.Forms; 
  using System.Data; 
  using System.Net; 
  using System.Net.Sockets; 
  using System.Text; 
  using System.IO; 
   
  namespace SocketSample 
  { 
   ///  
   /// Form1 的摘要說明。 
   /// 
 
   
   public class Form1 : System.Windows.Forms.Form 
   { 
   private System.Windows.Forms.Label label1; 
   private System.Windows.Forms.Label label2; 
   private System.Windows.Forms.Button Download; 
   private System.Windows.Forms.TextBox ServerAddress; 
   private System.Windows.Forms.TextBox Filename; 
   ///  
   /// 必需的設計器變量。 
   /// 
 
   private System.ComponentModel.Container 
   components = null; 
   public Form1() 
   { 
   // 
   // Windows 窗體設計器支持所必需的 
   // 
   InitializeComponent(); 
   
   // 
   // TODO: 在 InitializeComponent 
   // 調用后添加任何構造函數代碼 
   } 
   
   ///  
   /// 清理所有正在使用的資源。 
   /// 
 
   protected override void Dispose( bool disposing ) 
   { 
   if( disposing ) 
   { 
   if (components != null) 
   { 
   components.Dispose(); 
   } 
   } 
   base.Dispose( disposing ); 
   } 
   
   #region Windows Form Designer generated code 
   ///  
   /// 設計器支持所需的方法 - 不要使用代碼編輯器修改 
   /// 此方法的內容。 
   /// 
 
   private void InitializeComponent() 
   { 
   this.label1 = new System.Windows. 
   Forms.Label(); 
   this.label2 = new System.Windows. 
   Forms.Label(); 
   this.Download = new System.Windows. 
   Forms.Button(); 
   this.ServerAddress = new System.Windows. 
   Forms.TextBox(); 
   this.Filename = new System.Windows. 
   Forms.TextBox(); 
   this.SuspendLayout(); 
   // 
   // label1 
   // 
   this.label1.Location = new System.Drawing. 
   Point(16, 24); 
   this.label1.Name = "label1"; 
   this.label1.Size = new System.Drawing. 
   Size(80, 23); 
   this.label1.TabIndex = 0; 
   this.label1.Text = "服務器地址:"; 
   this.label1.TextAlign = System.Drawing. 
   ContentAlignment.MiddleRight; 
   // 
   // label2 
   // 
   this.label2.Location = new System.Drawing. 
   Point(16, 64); 
   this.label2.Name = "label2"; 
   this.label2.Size = new System.Drawing. 
   Size(80, 23); 
   this.label2.TabIndex = 1; 
   this.label2.Text = "本地文件名:"; 
   this.label2.TextAlign = System.Drawing. 
   ContentAlignment.MiddleRight; 
   // 
   // Download 
   // 
   this.Download.Location = new System. 
   Drawing.Point(288, 24); 
   this.Download.Name = "Download"; 
   this.Download.TabIndex = 2; 
   this.Download.Text = "開始下載"; 
   this.Download.Click += new System. 
   EventHandler(this.Download_Click); 
   // 
   // ServerAddress 
   // 
   this.ServerAddress.Location = new System. 
   Drawing.Point(96, 24); 
   this.ServerAddress.Name = "ServerAddress"; 
   this.ServerAddress.Size = new System. 
   Drawing.Size(176, 21); 
   this.ServerAddress.TabIndex = 3; 
   this.ServerAddress.Text = ""; 
   // 
   // Filename 

[1] [2]  下一頁




主站蜘蛛池模板: 欧洲一区在线观看 | 人人模人人看 | 青青草综合在线 | 四虎一区| 日韩一级欧美一级 | 天堂网2014av | 啪啪免费视频 | 色综合久久久久久888 | 日韩毛片在线影视 | 台湾佬成人中文网222vvv | 日本一卡2卡3卡四卡精品 | 四虎永久视频 | 天天看a | 色噜噜视频影院 | 亚洲成a人v欧美综合天堂下载 | 亚洲乱码一二三四五六区 | 在线欧美自拍 | 色屁屁影院免费观看入口 | 中文字幕第一页在线 | 亚洲碰碰| 亚洲丁香婷婷综合久久小说 | 中文字幕不卡免费高清视频 | 亚洲大尺度视频 | 午夜精品在线 | 欧美婷婷六月丁香综合色 | 午夜免费体验 | 四虎影视成人永久在线播放 | 一本久久道aa兔费看 | 日韩在线视频二区 | 日韩一区二区三区视频在线观看 | 天天躁日日躁狠狠躁综合 | 青青在线观看视频 | 先锋久久 | 日本www视频在线观看 | 欧美午夜在线观看 | 思思99re66在线精品免费观看 | 欧洲亚洲精品 | 中文精品久久久久国产网站 | 又粗又大又硬又爽的免费视频 | 四虎精品视频在线永久免费观看 | 午夜视频在线观看完整版 |