资源简介
代理服务器(Proxy Server)是一种重要的安全功能,它的工作主要在开放系统互联(OSI)模型的对话层,从而起到防火墙的作用。代理服务器大多被用来连接INTERNET(国际互联网)和INTRANET(局域网)。
本客户端支持 socks4代理/ 5和HTTP 1.1代理连接.
代码片段和文件信息
/*CAsyncProxySocket by Tim Kosse (Tim.Kosse@gmx.de)
Version 1.3 (2001-12-13)
--------------------------------------------------------
Introduction:
-------------
This class is a CAsyncSocket derived class. With this class you
can connect through SOCKS4/5 and HTTP 1.1 proxies. This class works
as semi-transparent layer between you own class and CAsyncSocket.
This class is used in FileZilla a powerful open-source FTP client.
It can be found under http://sourceforge.net/projects/filezilla
For more information about SOCKS4/5 goto
http://www.socks.nec.com/socksprot.html
For more information about HTTP 1.1 goto http://www.rfc-editor.org
and search for RFC2616
How to use?
-----------
You don‘t have to change much in you already existing code to use
CAsyncProxySocket.
To use it you‘ve to derive you own class from CAsyncProxySocket and
you‘ve to provide a definition for OnProxyOperationFailed(int nOpID) and
OnListenFinished(unsigned long &retProxyIpint &retProxyPort)=0;
When you create an instance of your derived class you should call
SetProxy.
If you overload the OnReceive or OnConnect functions you have to call
CAsyncProxySocket::OnReceive and CAsyncProxySocket::OnConnect
as first instrucion in your OnReceive and OnConnect functions.
Sample code:
CMyClass::OnReceive(int nErrorCode)
{
CAsyncProxySocket::OnReceive(nErrorCode);
//Add you own implementation below:
...
}
If an operation fails OnProxyOperationFailed is called. There
you can handle the error. int nOpID specifies the type of the operation
that failed: PROXYOP_CONNECT when a connection attempt failed and
PROXYOP_LISTEN when creating a listen socket failed.
If you want to use CAsyncProxySocket to create a listen socket you
have to use this overloaded function:
virtual BOOL Listen(unsigned long serverIp);
serverIP is the IP of the server you are already connected
through the SOCKS proxy. You can‘t use listen sockets over a
SOCKS proxy without a primary connection. Listen sockets are only
supported by SOCKS proxies this won‘t work with HTTP proxies.
When the listen socket is created successfully OnListenFinished is
called. The parameters unsigned long &retProxyIp and int &retProxyPort
will tell you the ip and the port of the listen socket.
After it you have to handle the OnAccept message and accept the
connection.
Description of the new functions and their parameters:
------------------------------------------------------
void SetProxy(int nProxyType);
void SetProxy(int nProxyType CString ProxyHost int nProxyPort);
void SetProxy(int nProxyType CString ProxyHost int nProxyPortCString ProxyUser CString ProxyPass);
Call one of this functions to set the proxy type.
Parametes:
- nProxyType specifies the Proxy Type.
- ProxyHost and nProxyPort specify the address of the proxy
- ProxyUser and ProxyPass are only available for SOCKS5 proxies.
supported proxy types:
PROXYTYPE_NOPROXY
PRO
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-03-15 14:07 casyncproxysocket_demo\
文件 26426 2001-12-13 17:01 casyncproxysocket_demo\AsyncProxySocket.cpp
文件 8089 2001-12-13 14:58 casyncproxysocket_demo\AsyncProxySocket.h
文件 2480 2001-12-09 12:06 casyncproxysocket_demo\CAsyncProxyDemo.cpp
文件 4749 2001-12-12 13:59 casyncproxysocket_demo\CAsyncProxyDemo.dsp
文件 1493 2001-12-09 12:06 casyncproxysocket_demo\CAsyncProxyDemo.h
文件 7349 2001-12-13 15:06 casyncproxysocket_demo\CAsyncProxyDemo.rc
文件 894 2010-03-15 14:01 casyncproxysocket_demo\CAsyncProxyDemo.sln
文件 8745 2010-03-15 14:01 casyncproxysocket_demo\CAsyncProxyDemo.vcproj
文件 7544 2001-12-13 15:10 casyncproxysocket_demo\CAsyncProxyDemoDlg.cpp
文件 1773 2001-12-12 17:06 casyncproxysocket_demo\CAsyncProxyDemoDlg.h
文件 23460 2001-12-12 13:58 casyncproxysocket_demo\Cba
文件 1538 2000-01-04 20:39 casyncproxysocket_demo\Cba
文件 1687 2001-12-13 17:00 casyncproxysocket_demo\MySocket.cpp
文件 814 2001-12-12 17:00 casyncproxysocket_demo\MySocket.h
目录 0 2001-12-09 12:06 casyncproxysocket_demo\res\
文件 1078 2001-12-09 12:06 casyncproxysocket_demo\res\CAsyncProxyDemo.ico
文件 431 2001-12-09 12:06 casyncproxysocket_demo\res\CAsyncProxyDemo.rc2
文件 1382 2001-12-09 12:15 casyncproxysocket_demo\resource.h
文件 219 2001-12-09 12:06 casyncproxysocket_demo\StdAfx.cpp
文件 1188 2001-12-09 12:06 casyncproxysocket_demo\StdAfx.h
- 上一篇:JS基础练习题
- 下一篇:ADC0809芯片英文资料
相关资源
- 异步HTTP请求及异步HTTP单元基于autoU
- C代码版本的HTTP POST上传文件/JSON
- 温度传感器
- 一个delphi封装的WinHttp
- Loadrunner 的HTTPS的测试配置
- 统一管理系统
- labview HTTP POST 通信程序 Demo.vi
- 使用HTTP上传文件到WEB服务器
- Apache配置文件httpd.conf
- 火狐httprequester文件
- 易语言Http读文件API源码
- HTTP 简介PPT
- libcurl.lib 支持HTTPS的静态库
- Arduino通过ESP8266模块使用HTTP协议连接
- boa源码支持HTTPS
- TinyHTTPd for Windows源码
- HTTP500修复脚本
- delphi写的自动升级演示 多线程+http服
- 监控网页内容,发现需要的内容后弹
- Qt 之 HTTP 请求支持断点续传
- 多线程http服务器实现流程图
- HTTP 抓包实战 肖佳 PDF
- EasyWebSvr
- 手写http服务器1.0.0版本
- Http File Server (HFS) 专用HFS模板 最终
- Http File Server (HFS) 专用HFS模板 最新
- System.Net.Http.dll.rar
- websphere配置https
- 自己分装的一个winhttp类
- Delphi通过https接口post数据
评论
共有 条评论