首页 新闻 会员 周边 捐助

关于request.time的问题

0
悬赏园豆:30 [已关闭问题]

 StreamReader sr = new StreamReader("data.txt");

 private   void run_Click(object sender, EventArgs e)
        {
            url = Uurl.Text.ToString();
            num = 0;
             if(url.Contains(@"http://"))
             {
                 url=url.Replace(@"http://","");
             }

            myThread  = new Thread(new ThreadStart(runSEO));
             this.run.Enabled = false;
             myThread.Start();
           
        

        }


        public   void runSEO()
        {
            try
            {
               
                while ((urlhead = sr.ReadLine()) != null)
                {

                    num = num + 1;
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlhead + url);
                    request.Timeout = 1000;
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            
               
               
                }
                sr.Close();
                run.Invoke(btnchange);
               
            }
            catch
            {
             
                run.Invoke(btnchange);
            }
        }

 

 

如果请求的网址超时,为什么我的线程是直接停止而不是跳过这个网址继续request下一个呢?怎样让它在请求一个网址不成功就跳过继续下一个?

piikee的主页 piikee | 初学一级 | 园豆:160
提问于:2010-05-10 13:56
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册