资源简介
代码来源于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文件
相关资源
- 编写简单的RMI程序 多线程web 服务器
- 多线程生产者消费者模式
- 多线程实例:桌面智能弹球小游戏
- WPF多线程演示
- 易语言:多线程传多变量的最稳定方
- 易语言 TCP使用HTTP、SOCKES5代理IP。
- 排队买票多线程问题
- 强大的完善的 活动抽奖系统适合各单
- 十字路口红绿灯交通情况模拟
- Qt 多线程连接数据库——数据库
- 易语言多线程端口扫描源码
- POSIX多线程程序设计中文版源码
- 易语言md5定向爆破源码
- 多线程扫描工具
- Delphi.High.Performance.Applications.Concurren
- Qt5的多线程小程序,实现按钮开关线
- 控制台串口通信程序
- POSIX多线程程序设计中文版pdf
- 使用多线程及图像分块实现图像处理
- 图像处理中使用多线程及图像分块实
- p2p文件共享系统 含代码和文档
- 武汉理工大学面向对象与多线程综合
- 多线程编程指南[中文完整翻译版] –
- QT多线程实现图片以缩略图形式显示
- qt利用线程实现多任务
- 基于socket的多线程QQ聊天系统(代码
- UDP socket 多线程
- linux多线程编程书籍
- 串口通信+多线程+数据错乱自动恢复
- VC五子棋源代码 想要的速度下哦 多线
评论
共有 条评论