Solved

Getting the bytes transfered from a machine

Posted on 2001-08-03
2
269 Views
Last Modified: 2010-04-06

Hai experts,

  How will we calculate the the amount of bytes transfered from a machine using a delphi application.

Can you send me an application which can be used for this purpose?
0
Comment
Question by:mrk_raj
2 Comments
 
LVL 3

Expert Comment

by:rondi
ID: 6347922
Could you elaborate...

Data passed between your own apps on different machines ?
 - easily done
Data passed between ANY apps ?
 - possible, but complex - you might have to write a
   sniffer or look into Winsock SPI - check out whatis.com

rondi.
0
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 50 total points
ID: 6348312
If you need a packet sniffer, you could try WinPCap

http://netgroup-serv.polito.it/winpcap/

Here's the URL to the Delphi header translations:

http://home1.stofanet.dk/nitezhifter/files/Delphi%20Pcap.zip


And an example code is as follows (by Smurff, in my PAQ):

unit Unit1;

interface

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

type
 TForm1 = class(TForm)
   Panel1: TPanel;
   Button1: TButton;
   ComboBox1: TComboBox;
   Memo1: TMemo;
   procedure FormCreate(Sender: TObject);
   procedure ComboBox1Change(Sender: TObject);
 private
   { Private declarations }
   FZniffer : TZniffer;
   procedure ReadPacket(Data:pointer;recvbytes:Word);
 public
   { Public declarations }
 end;

var
 Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
Fzniffer := TZniffer.create;
Fzniffer.OnPacket := ReadPacket;
Combobox1.Items.assign(Fzniffer.Adapters);
Combobox1.text:='< SELECT ADAPTER >';

end;

procedure TForm1.ComboBox1Change(Sender: TObject);
var E:string;
begin
 if Fzniffer.Snooping then
   if not Fzniffer.Deactivate(E) then  raise Exception.create(e);
 Fzniffer.AdapterIndex := COmbobox1.ItemIndex;
 if not Fzniffer.Activate(e) then raise Exception.create(e);
end;

procedure TForm1.ReadPacket(Data: pointer; recvbytes: Word);
begin
 memo1.Lines.add('Packet snooped. Bytes: '+inttostr(recvbytes) );
end;

end.

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now