QQ的文件传输是怎么实现的?………………………………………………………… 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;constRAS_MaxDeviceType = 16;//设备类型名称长度RAS_MaxEntryName = 256;//连接名称最大长度RAS_MaxDeviceName = 128;//设备名称最大长度RAS_MaxIpAddress = 15;//IP地址的最大长度RASP_PppIp = $8021;//拨号连接的协议类型,该数值表示PPP连接typeHRASCONN = DWORD;//拨号连接句柄的类型RASCONN = record//活动的拨号连接的句柄和设置信息dwSize : DWORD;//该结构所占内存的大小(Bytes), 一般设置为SizeOf(RASCONN) hrasconn : HRASCONN;//活动连接的句柄szEntryName : array[0..RAS_MaxEntryName] of char; //活动连接的名称szDeviceType : array[0..RAS_MaxDeviceType] of char;//活动连接的所用的设备类型szDeviceName : array[0..RAS_MaxDeviceName] of char;//活动连接的所用的设备名称end;TRASPPPIP = record//活动的拨号连接的动态IP地址信息dwSize : DWORD;//该结构所占内存的大小(Bytes),一般设置为SizeOf(TRASPPPIP) dwError : DWORD;//错误类型标识符szIpAddress : array[0..RAS_MaxIpAddress] of char;//活动的拨号连接的IP地址end;type TForm1 = class(TForm) Memo1: TMemo; procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;function RasEnumConnections(var lprasconn : RASCONN;//接收活动连接的缓冲区的指针 var lpcb: DWORD;//缓冲区大小 var lpcConnections : DWORD//实际的活动连接数 ) : DWORD; stdcall;function RasEnumConnections;external 'Rasapi32.dll' name 'RasEnumConnectionsA';//获取指定活动的拨号连接的动态IP信息function RasGetProjectionInfo( hrasconn : HRasConn;//指定活动连接的句柄 rasprojection : DWORD;//RAS连接类型 var lpprojection : TRASPPPIP;//接收动态IP信息的缓冲区 var lpcb : DWord//接收缓冲区的大小 ) : DWORD;stdcall;function RasGetProjectionInfo;external'Rasapi32.dll' name 'RasGetProjectionInfoA';var Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);const MaxConnections = 10;//假设最多有10个活动的拨号连接var connections : array[0..MaxConnections-1] of RASCONN; //拨号连接数组 longSize : dword; intAvailabelConnections : dword; //活动的拨号连接的实际数目 intIndex : integer; strTemp : string; dwResult : DWORD; dwSize : DWORD; RASpppIP : TRASPPPIP;//活动的拨号连接的动态IP地址信息begin connections[0].dwSize:=sizeof(RASCONN); longSize:=MaxConnections * connections[0].dwSize; //接收活动连接的缓冲区大小 intAvailabelConnections:=0; //获取所有活动的拨号连接的信息(连接句柄和设置信息) dwResult:=RasEnumConnections(connections[0],longSize,intAvailabelConnections); if 0<>dwResult then memo1.lines.add('错误:'+inttostr(dwResult)) else begin memo1.lines.add('现有的活动连接有'+IntToStr(intAvailabelConnections)+'个'); //显示所有活动的拨号连接的信息(设置信息和动态IP地址) for intIndex:=0 to intAvailabelConnections-1 do begin //显示一个活动的拨号连接的设置信息 strTemp := '连接名称:'+StrPAS(connections[intIndex].szEntryName) + ',设备类型:'+StrPAS(connections[intIndex].szDeviceType) + ',设备名称:'+StrPAS(connections[intIndex].szDeviceName); memo1.lines.add( strTemp ); //显示一个活动的拨号连接的动态IP地址 dwSize := SizeOf(RASpppIP); RASpppIP.dwSize := dwSize; dwResult := RASGetProjectionInfo(connections[intIndex].hRasConn,RASP_PppIp,RasPPPIP,dwSize);//获取动态IP地址 if 0 <> dwResult then memo1.lines.add('错误:'+inttostr( dwResult )) else memo1.lines.add('动态地址:'+StrPas(RASpppIP.szIPAddress)); end; end;end;end. 有空去菜鸟论坛灌水啊。。http://soft.at.9966.org 如何穿透防火墙呢?用DirectX可以实现点对点联接,自已操作数据流即可 就是Tcp连接嘛,用Winsock或者ClientSocket、ServerSocket就可以,需要自己定义个简单协议。 procedure TForm1.Button1Click(Sender: TObject);var MyFStream: TFileStream;begin If OpenDialog1.Execute then Begin fName:=ExtractFileName(OpenDialog1.FileName); NMStrm1.Host := Edit2.Text; NMStrm1.FromName := Edit1.Text; MyFStream := TFileStream.Create(OpenDialog1.FileName, fmOpenRead); try showmessage('开始传送!'); t1:=TimeToStr(now);//开始计时 //NMStrm1.SendStream(MyFStream); NMStrm1.PostIt(MyFStream); finally MyFStream.Free; end; end; end; 菜鸟MM的束手无策的问题! 帮忙给看看什么意思? 请教一个的问题!! 在DLL中使用ADO数据库的问题,100分! 有关在程序中实现SQL Server数据库备份的问题。如果分不够可以再加。 如何判断现在是ctrl_Z按下? 6.0的高手請進 如何在TClientSocket的OnDisconnect事件中关闭Socket 关于数据库数据自加的问题 为什么我的ado连接SQL SERVER 数据库时速度很慢(记录>=5000)? 制作安装程序中的烦恼 memo的自动滚动
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;const
RAS_MaxDeviceType = 16;//设备类型名称长度
RAS_MaxEntryName = 256;//连接名称最大长度
RAS_MaxDeviceName = 128;//设备名称最大长度
RAS_MaxIpAddress = 15;//IP地址的最大长度
RASP_PppIp = $8021;//拨号连接的协议类型,该数值表示PPP连接type
HRASCONN = DWORD;//拨号连接句柄的类型
RASCONN = record//活动的拨号连接的句柄和设置信息
dwSize : DWORD;//该结构所占内存的大小(Bytes), 一般设置为SizeOf(RASCONN)
hrasconn : HRASCONN;//活动连接的句柄
szEntryName : array[0..RAS_MaxEntryName] of char;
//活动连接的名称
szDeviceType : array[0..RAS_MaxDeviceType] of char;
//活动连接的所用的设备类型
szDeviceName : array[0..RAS_MaxDeviceName] of char;
//活动连接的所用的设备名称
end;
TRASPPPIP = record//活动的拨号连接的动态IP地址信息
dwSize : DWORD;//该结构所占内存的大小(Bytes),一般设置为SizeOf(TRASPPPIP)
dwError : DWORD;//错误类型标识符
szIpAddress : array[0..RAS_MaxIpAddress] of char;
//活动的拨号连接的IP地址
end;
type
TForm1 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function RasEnumConnections(var lprasconn : RASCONN;
//接收活动连接的缓冲区的指针
var lpcb: DWORD;//缓冲区大小
var lpcConnections : DWORD//实际的活动连接数
) : DWORD; stdcall;
function RasEnumConnections;external 'Rasapi32.dll'
name 'RasEnumConnectionsA';
//获取指定活动的拨号连接的动态IP信息
function RasGetProjectionInfo(
hrasconn : HRasConn;//指定活动连接的句柄
rasprojection : DWORD;//RAS连接类型
var lpprojection : TRASPPPIP;//接收动态IP信息的缓冲区
var lpcb : DWord//接收缓冲区的大小
) : DWORD;stdcall;
function RasGetProjectionInfo;external
'Rasapi32.dll' name 'RasGetProjectionInfoA';
var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
const
MaxConnections = 10;//假设最多有10个活动的拨号连接
var
connections : array[0..MaxConnections-1] of RASCONN;
//拨号连接数组
longSize : dword;
intAvailabelConnections : dword;
//活动的拨号连接的实际数目
intIndex : integer;
strTemp : string;
dwResult : DWORD;
dwSize : DWORD;
RASpppIP : TRASPPPIP;
//活动的拨号连接的动态IP地址信息
begin
connections[0].dwSize:=sizeof(RASCONN);
longSize:=MaxConnections * connections[0].dwSize;
//接收活动连接的缓冲区大小
intAvailabelConnections:=0;
//获取所有活动的拨号连接的信息(连接句柄和设置信息)
dwResult:=RasEnumConnections(connections[0],longSize,intAvailabelConnections);
if 0<>dwResult then memo1.lines.add('错误:'+inttostr(dwResult))
else
begin
memo1.lines.add('现有的活动连接有'+IntToStr(intAvailabelConnections)+'个');
//显示所有活动的拨号连接的信息(设置信息和动态IP地址)
for intIndex:=0 to intAvailabelConnections-1 do
begin
//显示一个活动的拨号连接的设置信息
strTemp := '连接名称:'+StrPAS(connections[intIndex].szEntryName)
+ ',设备类型:'+StrPAS(connections[intIndex].szDeviceType)
+ ',设备名称:'+StrPAS(connections[intIndex].szDeviceName);
memo1.lines.add( strTemp );
//显示一个活动的拨号连接的动态IP地址
dwSize := SizeOf(RASpppIP);
RASpppIP.dwSize := dwSize;
dwResult := RASGetProjectionInfo(connections[intIndex].hRasConn,RASP_PppIp,RasPPPIP,dwSize);//获取动态IP地址
if 0 <> dwResult then memo1.lines.add('错误:'+inttostr( dwResult ))
else memo1.lines.add('动态地址:'+StrPas(RASpppIP.szIPAddress));
end;
end;
end;end.
http://soft.at.9966.org
var
MyFStream: TFileStream;
begin
If OpenDialog1.Execute then
Begin
fName:=ExtractFileName(OpenDialog1.FileName);
NMStrm1.Host := Edit2.Text;
NMStrm1.FromName := Edit1.Text;
MyFStream := TFileStream.Create(OpenDialog1.FileName, fmOpenRead);
try
showmessage('开始传送!');
t1:=TimeToStr(now);//开始计时 //NMStrm1.SendStream(MyFStream);
NMStrm1.PostIt(MyFStream);
finally
MyFStream.Free;
end;
end;
end;