Advertisement
Guest User

CAPTEN NEW RPM

a guest
Sep 17th, 2014
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit Unit1;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdMappedPortTCP,
  6.   StdCtrls, VrControls, VrLcd, ExtCtrls, VrAngularMeter, VrMeter, jpeg,
  7.   sSkinManager, sSkinProvider;
  8. type
  9.   TForm1 = class(TForm)
  10.     Button1: TButton;
  11.     Button2: TButton;
  12.     IdMappedPortTCP1: TIdMappedPortTCP;
  13.     Label1: TLabel;
  14.     Label2: TLabel;
  15.     Timer1: TTimer;
  16.     Timer2: TTimer;
  17.     Image1: TImage;
  18.     VrNum1: TVrNum;
  19.     VrNum2: TVrNum;
  20.     sSkinProvider1: TsSkinProvider;
  21.     sSkinManager1: TsSkinManager;
  22.     VrMeter1: TVrMeter;
  23.     procedure Button1Click(Sender: TObject);
  24.     procedure Button2Click(Sender: TObject);
  25.     procedure IdMappedPortTCP1Execute(AThread: TIdMappedPortThread);
  26.     procedure Timer1Timer(Sender: TObject);
  27.     procedure IdMappedPortTCP1OutboundData(AThread: TIdMappedPortThread);
  28.     procedure Timer2Timer(Sender: TObject);
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34. var
  35.   Form1: TForm1;
  36.   Download : Integer;
  37.   Upload : Integer;
  38. implementation
  39. {$R *.dfm}
  40. procedure TForm1.Button1Click(Sender: TObject);
  41. begin
  42. IdMappedPortTCP1.Bindings.Add.Ip:='127.0.0.1';
  43. IdMappedPortTCP1.Bindings.Add.Port:=StrToInt('9876');
  44. IdMappedPortTCP1.MappedHost:='10.1.89.130';
  45. IdMappedPortTCP1.MappedPort:=StrToInt('8000');
  46. IdMappedPortTCP1.Active:=True;
  47. Button1.Enabled:=False;
  48. Button2.Enabled:=True;
  49. end;
  50. procedure TForm1.Button2Click(Sender: TObject);
  51. begin
  52. IdMappedPortTCP1.Active:=False;
  53. IdMappedPortTCP1.Bindings.Clear;
  54. Button1.Enabled:=True;
  55. Button2.Enabled:=False;
  56. end;
  57. procedure TForm1.IdMappedPortTCP1Execute(AThread: TIdMappedPortThread);
  58. var
  59. ESIND:string;
  60. begin
  61.     ESIND:='GETS http://klip.telkomsel.com/ HTTP/1.1'+#13#10+'User-Agent: Mozilla/5.0 (Windows NT6.1; rv:14.0) Gecko/20100101 Firefox/14.0'#13#10'Host : klip.telkomsel.com'#13#10#13#10#13#10;
  62.     if pos('CONNECT',athread.NetData) <>0 then
  63.     athread.NetData:=athread.NetData+ESIND;
  64.    upload:= upload+Length(AThread.NetData);
  65. end;
  66. procedure TForm1.Timer1Timer(Sender: TObject);
  67. begin
  68. Label1.Caption :=  FormatFloat('Down: ##0.## KB/s',download/1024);
  69. Label2.Caption :=  FormatFloat('Up: ##0.## KB/s',upload/1024);
  70. download:= 0;
  71. upload:= 0;
  72. end;
  73. procedure TForm1.IdMappedPortTCP1OutboundData(
  74.   AThread: TIdMappedPortThread);
  75. begin
  76.  download:=download+Length(AThread.NetData);
  77. end;
  78. procedure TForm1.Timer2Timer(Sender: TObject);
  79. begin
  80. Label1.Caption :=  FormatFloat('0',download/1024);
  81. Label2.Caption :=  FormatFloat('0',upload/1024);
  82. VrNum1.Value := StrToInt (Label1.Caption);
  83. VrNum2.Value := StrToInt (Label2.Caption);
  84. VrMeter1.Position:=download div 1024;
  85. download:= 0;
  86. upload:= 0;
  87. end;
  88. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement