网络(163)计费(100分)

  • 主题发起人 主题发起人 新余万为清
  • 开始时间 开始时间

新余万为清

Unregistered / Unconfirmed
GUEST, unregistred user!
我想做网络(163)计费程序,遇到如下问题:
如何监控网络拨号程序?如何知道网络拨号程序已经启动、终止?
如何得到网络流量?怎样在程序中实现网络拨号?
 
1》可以通过snmp来做,查询陆游器里关于记费的table,就能得到很详细的信息。
2》用proxy,这方面的讨论太多了,检索一下。
 
No one can do it??
 
找同类软件的作者问一问。
 
哪位作者?
 
我这里有几个关于拨号网络的VCL控件包括例程,如果感兴趣可以MAIL给你
以下的例子可以用来控制拨号,取得IP,速率等(需一个DIALUP的VCL)

//MIAN_F.PAS

{$A+,B-,C+,D+,E-,F-,G+,H+,I+,J+,K-,L+,M-,N+,O-,P+,Q+,R+,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE GUI}

unit Main_F;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DialUp, ExtCtrls;

type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Label1: TLabel;
Status: TLabel;
Status2: TLabel;
CheckBox1: TCheckBox;
DialUp: TDialUp;
Button6: TButton;
ListBox2: TListBox;
Button8: TButton;
Label2: TLabel;
RecvL: TLabel;
Label4: TLabel;
XmitL: TLabel;
SpeedL: TLabel;
SpeedLL: TLabel;
Bevel1: TBevel;
Label3: TLabel;
Label5: TLabel;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure DialUpEntryGet(Sender: TObject; EntryName: array of Char);
procedure Button3Click(Sender: TObject);
procedure DialUpConnect(Sender: TObject);
procedure DialUpError(Sender: TObject; ErrorCode: Integer;
ErrorMessage: String);
procedure DialUpDialing(Sender: TObject);
procedure DialUpNotConnected(Sender: TObject; ErrorCode: Integer;
ErrorMessage: String);
procedure DialUpAsyncEvent(Sender: TObject; State, Error: Integer;
MessageText: String);
procedure Button4Click(Sender: TObject);
procedure DialUpActiveConnection(Sender: TObject; Handle: Integer;
Status: TRasConnStatusA; StatusString: String; EntryName, DeviceType,
DeviceName: array of Char);
procedure Button8Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Clear; Button2.Enabled:=True;
DialUp.GetEntries;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if ListBox1.Items.Count=0 then
begin
ShowMessage('Choose entry with get entries first');
Exit;
end;
if RadioButton1.Checked then DialUp.DialMode:=dmAsync else DialUp.DialMode:=dmSync;
DialUp.Entry:=ListBox1.Items[ListBox1.ItemIndex];
DialUp.Dial;
end;

procedure TForm1.DialUpEntryGet(Sender: TObject; EntryName: array of Char);
begin
ListBox1.Items.Add(PChar(@EntryName[0]));
ListBox1.ItemIndex:=0;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
DialUp.HangUp;
end;

procedure TForm1.DialUpConnect(Sender: TObject);
begin
Status2.Caption:='Connected.';
end;

procedure TForm1.DialUpError(Sender: TObject; ErrorCode: Integer;
ErrorMessage: String);
begin
Status2.Caption:='Error';
end;

procedure TForm1.DialUpDialing(Sender: TObject);
begin
Status2.Caption:='Dialing...'; Application.ProcessMessages;
end;

procedure TForm1.DialUpNotConnected(Sender: TObject; ErrorCode: Integer;
ErrorMessage: String);
begin
Status2.Caption:='Not Connected';
end;

procedure TForm1.DialUpAsyncEvent(Sender: TObject; State, Error: Integer;
MessageText: String);
begin
Status.Caption:=MessageText;
if Error<>0 then Status2.Caption:='Error. Press Hangup button next to Dial button.';
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
ListBox1.Clear; Button2.Enabled:=False;
DialUp.GetConnections;
end;

procedure TForm1.DialUpActiveConnection(Sender: TObject; Handle: Integer;
Status: TRasConnStatusA; StatusString: String; EntryName, DeviceType,
DeviceName: array of Char);
begin
ListBox1.Items.Add(EntryName+' | '+DeviceName+' || '+StatusString+'('+IntTOStr(Status.rasconnstate)+')');
DialUp.GetIP(DialUp.hRAS);
ListBox1.Items.Add('Server IP: "'+DialUp.ServerIP+'" Client IP:"'+DialUp.ClientIP+'"');

if CheckBox1.Checked then DialUp.HangUpConn(Handle);
end;

procedure TForm1.Button8Click(Sender: TObject);
begin
DialUp.SearchDUNA;
ListBox2.Items.Assign(DialUp.DUNA);
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
DialUp.InitializePerfStats(True,True);
Timer1.Enabled:=True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if not DialUp.GetPerfStats then
begin
Beep;
XmitL.Caption:='ERROR';
RecvL.Caption:='ERROR';
SpeedL.Caption:='ERROR';
end else
begin
XmitL.Caption:=IntToStr(DialUp.BytesXmit);
RecvL.Caption:=IntToStr(DialUp.BytesRecv);
SpeedL.Caption:=IntToStr(DialUp.ConnectionSpeed);
end;
end;

end.


//MIAN_F.DFM


 
将问题提前
 
接受答案了.
 
后退
顶部