资源简介
代码来源于CSDN,但是那个代码有很多错误都被我修改了,软件使用快代理的VIP功能获取代理IP,并获取指定地区IP,并多线程测试是否可用(项目完整并可运行)且使用多线程做校验
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Text.Regularexpressions;
using System.Collections;
using System.Threading;
namespace Proxy
{
public partial class Form1 : Form
{
private DataTable dt = new DataTable();
private Queue urlList = new Queue();
private Queue ipList = new Queue();
private delegate void addRowDelegate(object[] obj);//定义委托
private delegate void updateRowDelegate(string str);
Thread myThread;
private int id = 0;
private int currentIndex = 0;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
myThread = new Thread(downLoad);//实例化线程
myThread.Start();//启动线程
}
private void downLoad()
{
urlList.Enqueue(“http://www.ipfree.cn/index2-1.html“);
urlList.Enqueue(“http://www.ipfree.cn/index2-2.html“);
urlList.Enqueue(“http://www.ipfree.cn/index2-3.html“);
urlList.Enqueue(“http://www.ipfree.cn/index2-4.html“);
urlList.Enqueue(“http://www.ipfree.cn/index2-5.html“);
while (urlList.Count > 0)
{
System.Net.ServicePointManager.DefaultConnectionLimit = 100;
// WebPageState state = new WebPageState(“http://www.ipfree.cn/index2-1.html“);
WebPageState state = new WebPageState(urlList.Dequeue().ToString());
state.ProcessStarted = true;
state.ProcessSuccessfull = false;
WebResponse res = null;
try
{
// Console.WriteLine(“[ “ + DateTime.Now + “ ][ “ + Thread.CurrentThread.Name + “ ]: “ + “{0} Download Start: {1}“ + “总下载:“ + Fron.Common.AppPara.DownLoadCount state.Uri.ToString() state.ProcessSuccessfull);
//WebProxy proxy = new WebProxy();
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)WebRequest.Create(state.Uri);
req.ServicePoint.ConnectionLimit = 500;
//proxy.Address = new Uri(“http://219.150.144.58:80“);
//req.Headers.Add(“VIA“ ““);
//req.Headers.Add(“X_FORWARDED_FOR“ ““);
// req.Proxy = proxy;
req.Timeout = 600000;
res = req.GetResponse();
if (res is HttpWebResponse)
{
state.StatusCode = ((HttpWebResponse)res).StatusCode.ToString();
state.StatusDescription = ((HttpWebResponse)res).StatusDescription;
}
if (res is Fi
- 上一篇:rdlc报表表达式应用(字符串和转换)
- 下一篇:bmp转化565或888C文件
相关资源
- Socket多线程.rar
- 豆瓣图书TOP250多线程爬虫代码
- 多线程UDP接收数据并存储
- tcl入门教程(包括常用的socket多线程
- 多线程网段端口扫描器
- 多线程矩阵乘法
- 用多线程同步方法解决哲学家就餐问
- 字符串高级查找替换器delphi源代码
- 多线程文件搜索专家(delphi源码)
- 多串口数据采集.zip
- 多线程与单线程的对比采用CreateThre
- tcp client简单 连接,发送接收断开,多
- Qt实现Winsock网络编程—Tcp服务端和
- 域名批量查找工具 bestDN多线程破解版
- 易语言鱼刺类多线程模块
- qtTCP多线程服务的
- Win32多线程程序设计--源代码
- Ping检测工具,同时ping多个地址
- 多线程编程指南PDF
- 尚硅谷JUC视频笔记整理很详细和全面
- bestDN多线程破解版.晕死上次传的有密
- Qt多线程串口通信可变长接口子线程内
- VC多线程串口编程
- 易语言:多线程完美案例
- Training Syllabus培训大纲:多线程
- 易语言多线程
- 网站密码猜解爆破工具V3.2(多线程综
- 易语言多线程枚举IP段内所有IP
- 易语言:多线程多任务 模块
- MFC多线程文件传输(客户端、服务器
评论
共有 条评论