600分寻一答案,有本事就进来拿。。。。。。。。。 (6分)

  • 主题发起人 主题发起人 yeah007
  • 开始时间 开始时间
Y

yeah007

Unregistered / Unconfirmed
GUEST, unregistred user!
怎么让SocketConnection支持SOCKET5代理?
使用纯SOCKET比较容易实现,但如果使用SocketConnection,则比较麻烦,各位有什么好点子?
分可以到其他帖子取!
 
关注.....................
 
使用SocketConnection也很方便啊,不清楚你的想法![:(][^]
 
你把6分换成600分,试试?
 
呵呵,原来是分数的问题啊,只要解决,分不是问题!
 
什麼年代了, 還在用SocketConnection, 不怕麻煩.
 
重赏之下必有勇夫,
问题问的含糊不清
 
hcm0790: 是吗?那要听听老兄的高见了,请赐教!
 
现在我分数用光了,不过只要能解决问题,分数一定会如数给的!
 
hcm0790:你用什么技术啊,倒说来看看!呵呵
 
我觉得用MTS可能好些。
 
代理和MTS有关系吗?
 
怎么说没牛人呢?至少楼主就是牛人吗
 
有一种办法,可以在不修改原来程序的情况下使原来的程序支持
Socks5代理,
你只需要找到这样一个软件就可以了:
SocksCap32 V2.33
其实,自己继承一个连接对象,也不需要写太多的代码,
找一个支持socks5的socket对象(ICS中的也可以)
 
TO LiChaoHui:
使用SocksCap32 不太好吧!
继承?怎么继承呢?
主要是SOCKETConnection的连接方式和一般的SOCKET不一样,好象使用了什么IBLOCKDATA等
的东西,所以即使改系统文件来支持,也不知道从哪里下手?
 
//------------------------------------------------------------------------------
//
// Programm : ovrMIDASwr (MIDAS interface wrapper, calls router)
//
// v 1.01 09/1999 Freeware
//
// by Al-dr Petroff, APetrov@ase.ru
// ASE Group (Advanced System Engineering)
// http://www.ase.ru/
// (Full english version of our ovrMIDAS platform is under construction)
//
//------------------------------------------------------------------------------
// MIDAS 3 only (Delphi 5)
//------------------------------------------------------------------------------
//
// This program perfoms some OleEnterprise features
// for SocketsConnections (MIDAS):
// 1. All clients can points to only this one RemoteServer
// (this RemoteServer hold its Global Object repository in simple inifile)
// 2. Clients can communicate with any selected RemoteServer
// in two ways:
// a. continue communicate with ovrMIDASWr as with desired RemoteServer
// - this way allows to bypass some network restrictions and
// can switch before different TDispatchConnection types.
// - you can also obtain chained interface for direct operation
// b. obtain from ovrMIDASWr actual addres of desired RemoteServer
// and set own direct connection with RemoteServer.
//
// 3. RemoteServers being started can inform ovrMIDASWr about its new
// actual location or substitute another RemoteServers
// 4. Kills on-place-depending problems (debug, installation, support ...)
// 5. Optionally can fully support ObjectBrokers model.
// 6. Optionally can offer additional centalizaed monitor/proxy functions
// (access control, ping, trace etc) .
// 7. Optionally can offer many others simple benefits.
//
// !!! it do
es support users chained Ole methods calls.
//
//
// For example, you can put ovrMIDASWr on web server, and points
// all your clients to it - now you can communicate with desired
// RemoteServer behind the firewall. All required installation
// is only one ovrMIDASWr.exe file (size about 490K).
//
// As TDispatchConnection on client side TShConnection or TOverConnection
// recommended. They can transport chained interfaces. Or you can
// store returned chained interface to local variable.
//
// See ini file for more information.
//
//
// Is a very simple programm. Top effect with ovrMIDAS platform.
// 28/09/1999 by Al-dr Petroff APetrov@ase.ru
//
unit MIDASWrs;
interface
uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, MIDASWr_TLB, Stdvcl, Forms, Db, MConnect, SConnect, IniFiles;
// ExtCtrls;
type // !!! inherits from TDataModule, not TRemoteDataModule
// TRemoteDatamodule fails with "provider'*' not exported"
TMIDASWr_ = class(TDataModule, IMIDASWr)
Link: TSocketConnection;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
procedure CheckLink;//internal use
function CheckChainedIsWrapper(DC : TDispatchConnection) : boolean;
public
{ Public declarations }
// basic MIDAS API calls substitution
function AS_ApplyUpdates(const ProviderName: WideString;
Delta: OleVariant;
MaxErrors: Integer;
out ErrorCount: Integer;
var OwnerData: OleVariant): OleVariant;
safecall;
function AS_DataRequest(const ProviderName: WideString;
Data: OleVariant): OleVariant;
safecall;
procedure AS_Execute(const ProviderName: WideString;
const CommandText: WideString;
var Params, OwnerData: OleVariant);
safecall;
function AS_GetProviderNames: OleVariant;
safecall;
function AS_GetParams(const ProviderName: WideString;
var Ownerdata: OleVariant): OleVariant;
safecall;
function AS_GetRecords(const ProviderName: WideString;
Count: Integer;
out RecsOut: Integer;
Options: Integer;
const CommandText: WideString;
var Params, OwnerData:OleVariant): OleVariant;
safecall;
function AS_RowRequest(const ProviderName: WideString;
Row: OleVariant;
RequestType: Integer;
var OwnerData: OleVariant): OleVariant;
safecall;
// set connection with desired RemoteServer (from its Repository)
// AS_DataRequest('*',[<ServerAlias>]):VariantInterface
// so after this call you can use chained IAppServer directly
// for example, add in TXXXConnection.onAfterConnect on client side line as_DataRequest('*',['MyServer'])
// and alldo
ne.
function do
Link(AServerAlias : string;
ReturnInterface : boolean=false;
ALink : TSocketConnection=nil) : OleVariant;
//adds/updates RemoteServer info in repository
// AS_DataRequesr('=',[<ServerAlias>,<ServerInformation>])
procedure SetLink(AServerAlias : string;
Settings : OleVariant);
//returns actual location of desired RemoteServer
// AS_DataRequesr('*',[<ServerAlias>]):<ServerInformation>
function GetLink(AServerAlias : string) : OleVariant;
end;

implementation
{$R *.DFM}
function TMIDASWr_.AS_ApplyUpdates(const ProviderName: WideString;
Delta: OleVariant;
MaxErrors: Integer;
out ErrorCount: Integer;
var OwnerData: OleVariant): OleVariant;
begin
// just redirects
Result:=Link.GetServer.AS_ApplyUpdates(ProviderName, Delta, MaxErrors, ErrorCount, OwnerData);
end;

function TMIDASWr_.AS_DataRequest(const ProviderName: WideString;
Data: OleVariant): OleVariant;
begin
case ProviderName[1] of
//return interface of chained app server for MasterConnection (Link)
'*' : Result:=DoLink(Data[0],Data[1],Link);
//return current connection attributes for required app server
'?' : Result:=GetLink(Data[0]);//GetLink
//set current connection attributes for required app server
'=' : SetLink(Data[0],Data[1]);//SetLink
//setting connection with some additional chained app server and return it's interface
//here you can share some remoted interfaces in single connection
'@' : Result:=DoLink(Data[0],true);
else
begin
CheckLink;
Result:=Link.GetServer.AS_DataRequest(ProviderName, Data);
end
end;
end;

procedure TMIDASWr_.AS_Execute(const ProviderName, CommandText: WideString;
var Params, OwnerData: OleVariant);
begin
CheckLink;
Link.GetServer.AS_Execute(ProviderName, CommandText, Params, OwnerData);
end;

function TMIDASWr_.AS_GetParams(const ProviderName: WideString;
var Ownerdata: OleVariant): OleVariant;
begin
CheckLink;
Result:=Link.GetServer.AS_GetParams(ProviderName,OwnerData);
end;

function TMIDASWr_.AS_GetProviderNames: OleVariant;
begin
CheckLink;
Result:=Link.GetServer.AS_GetProviderNames;
end;

function TMIDASWr_.AS_GetRecords(const ProviderName: WideString;
Count: Integer;
out RecsOut: Integer;
Options: Integer;
const CommandText: WideString;
var Params,
OwnerData: OleVariant): OleVariant;
begin
CheckLink;
Result:=Link.GetServer.AS_GetRecords(ProviderName,Count,RecsOut,Options,CommandText,Params,OwnerData);
end;

function TMIDASWr_.AS_RowRequest(const ProviderName: WideString;
Row: OleVariant;
RequestType: Integer;
var OwnerData: OleVariant): OleVariant;
begin
CheckLink;
Result:=Link.GetServer.AS_RowRequest(ProviderName,Row,RequestType,OwnerData);
end;

class procedure TMIDASWr_.UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
RegisterPooled(ClassId,16,10);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
UnRegisterPooled(ClassId);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;

function TMIDASWr_.DoLink(AServerAlias: string;
ReturnInterface : boolean=false;
ALink : TSocketConnection=nil) : OleVariant;
var ServerSect : string[40];
S : String;
wLink : TSocketConnection;
begin
// just reads server settings from inf file,
// using global defaults in common section
// create connection component if nedeed
Result:=null;
if Assigned(ALink)
then
wLink:=ALink
else
wLink:=TSocketConnection.Create(Self);
wLink.Connected:=false;
S:=ChangeFileExt(ParamStr(0),'.ini');
with TIniFile.Create(S)do
try
if AServerAlias=''
then
ServerSect:=ReadString('Common','Default','')
else
ServerSect:=AServerAlias;
wLink.Host:='';
wLink.Address:=ReadString(ServerSect,'Address',ReadString('Common','Address',''));
wLink.InterceptGUID:=ReadString(ServerSect,'InterceptGUID',ReadString('Common','InterceptGUID',''));
wLink.Address:=ReadString(ServerSect,'Address',ReadString('Common','Address',''));
wLink.ServerName:=ReadString(ServerSect,'ServerName',ReadString('Common','ServerName',''));
wLink.ServerGUID:=ReadString(ServerSect,'ServerGUID',ReadString('Common','ServerGUID',''));
wLink.Port:=ReadInteger(ServerSect,'Port',ReadInteger('Common','Port',211));
wLink.SupportCallbacks:=ReadBool(ServerSect,'SupportCallbacks',ReadBool('Common','SupportCallbacks',true));
S:=ReadString(ServerSect,'Host',ReadString('Common','Host',''));
if (S<>'') and (wLink.Address='') then
wLink.Host:=S;
finally
free
end;
if ReturnInterface then
begin
wLink.Connected:=true;
if CheckChainedIsWrapper(wLink) //immidiate chained request for multi chained interfaces
then
Result:=wLink.GetServer.AS_DataRequest('@',VarArrayOf([AServerAlias, true]))
else
Result:=wLink.AppServer;
end;
end;

procedure TMIDASWr_.CheckLink;
begin
// sets default connection if needed
if Link.Connected then
exit;
if Link.Port<0 then
do
Link('');
Link.Connected:=true;
end;

function TMIDASWr_.GetLink(AServerAlias: string) : OleVariant;
var ServerSect : string[40];
S : String;
begin
// packs desired repository section into OleVariant data
// format: [[<PropertyName>,<PropertyValue>],...]
S:=ChangeFileExt(ParamStr(0),'.ini');
with TIniFile.Create(S)do
try
if AServerAlias=''
then
ServerSect:=ReadString('Common','Default','')
else
ServerSect:=AServerAlias;
Result:=VarArrayOf([
VarArrayOf(['Address',ReadString(ServerSect,'Address',ReadString('Common','Address','127.0.0.1'))]),
VarArrayOf(['InterceptGUID',ReadString(ServerSect,'InterceptGUID',ReadString('Common','InterceptGUID',''))]),
VarArrayOf(['ServerName',ReadString(ServerSect,'ServerName',ReadString('Common','ServerName',''))]),
VarArrayOf(['ServerGUID',ReadString(ServerSect,'ServerGUID',ReadString('Common','ServerGUID',''))]),
VarArrayOf(['ReadInteger',ReadString(ServerSect,'Port',ReadString('Common','Port','211'))]),
VarArrayOf(['SupportCallbacks',ReadString(ServerSect,'SupportCallbacks',ReadString('Common','SupportCallbacks','1'))]),
VarArrayOf(['Host',ReadString(ServerSect,'Host',ReadString('Common','Host',''))])
]);
finally
free
end
end;

procedure TMIDASWr_.SetLink(AServerAlias: string;
Settings : OleVariant);
var ServerSect : string[40];
S : String;
I : Integer;
begin
//writes/update actual RemoteServer settings
S:=ChangeFileExt(ParamStr(0),'.ini');
with TIniFile.Create(S)do
try
if AServerAlias=''
then
ServerSect:=ReadString('Common','Default','')
else
ServerSect:=AServerAlias;
try EraseSection(ServerSect) except end;
for I:=0 to VarArrayHighBound(Settings,1)do
if not VarIsNull(Settings[1]) and
(string(Settings[1])<>'')
then
WriteString(ServerSect,Settings[0],Settings[1]);
finally
free
end
end;

// that'all
function TMIDASWr_.CheckChainedIsWrapper(DC: TDispatchConnection): boolean;
// the simplest
var I : IMidasWr;
begin
DC.GetServer.QueryInterface( IMidasWr,I);
Result:=Assigned(I);
I:=nil;
end;

initialization
TComponentFactory.Create(ComServer, TMIDASWr_,
Class_MIDASWr_, ciMultiInstance, tmApartment);
end.

 
樓主呀,你才有多少分呀。
富翁称号 总积分 本轮得分 专家分 本轮排名 总排名
yeah007 29 0 41 806 11935
不要吹水了。。要人家幫你解答也不用吹NIU呀。。你不吹說不定還有人幫你搞定。。[:D]
 
我不是说到其他帖子拿吗,老兄
 
to aolo;
你这是能通过放火墙,但我需要的是能够通过SOCKET5代理服务器
 
这是我在borland新闻组发现的,希望对你有帮助
you can build external application, this application or service stay on
client machine, this application recive in por number 21000 (you must set
your socket connection to 127.0.0.1 port 21000) then
send the information to
another proxy 5 port to socket server. You can build this application with
INDY, TClientSocket and TServerSocket
Manuel
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部