Link to home
Start Free TrialLog in
Avatar of alpires
alpiresFlag for Brazil

asked on

TCP/UDP connections

Hi Experts,

Exist some way to do a program in delphi to display all TCP and UDP connections in my machine, and can close a connection?

I am using delphi 7

thx
Alexandre
Brazil
ASKER CERTIFIED SOLUTION
Avatar of Johnjces
Johnjces
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alpires

ASKER

Johnjces I downloaded the program http://smeschini.altervista.org/download/netstat32.php but the source is very complicated for me, I do not understand anything, would you help me?
you could write an example of how to get the tcp connections but with tform and Tlistview created in design time?

Thx
Well, that code is an entrie application. It is a shame that he did not include a dfm file. But, you caqn see you need a listbox and some other stuff.

If I have time tomorrow I will see what I can do for you!

John
Avatar of alpires

ASKER

Please do it for me, if you want I can open another question to give you another 500 points
No worries. But it will be tomorrow I will see what I can do! No need to open a new thread.

Might have some code somewhere that will block ports... not sure though.

John
Alexandre,

What you need to do in Delphi to make this work is very simple!

Start Delphi and go to File > New  then select > Console Application

You will have a formless project.

Copy the entire code EXCEPT for the top portion which is:

program Netstat32; // Advanced Netstat Delphi Source Code (GUI version) - (C) 2003-2005 Salvatore Meschini

(*

If you like this program or you are looking for a custom version please write me at salvatoremeschini@tiscali.it ! Thank you!
Se vuoi dare un contributo allo sviluppo di questo programma scrivi a salvatoremeschini@tiscali.it ! Grazie!

Salvatore Meschini
http://salvatoremeschini.cjb.net

*)

Again, do not copy the above, just everything below it.

I do not have TMSSoftware's WindXPResource stuff, so delete form the code the following lines, unless you happen to have that item.

{$R WINDRES.RES}
{$R WINXP.RES} // Thanks to TMSSOFTWARE - http://www.tmssoftware.com

Again, remove/delete the above 2 lines.

Save it as a project and name it NetStat32.dpr.

Compile it and check for any errors. Run it. You will have a GUI application with some pretty good code to work with.

It ran just fine for me!

Some other stuff which is fairly complex but may help you, is on my FTP site.

In your browser enter:

ftp://jcitssystems.com/pub/DelphiComps and download from there

ipfwhook.zip    and
ipflite.zip

These are components AND source for a complete firewall for Windows. You can drop port packets and other stuff.

I have not used them muhc and do not know where I got them. You are on your own in trying to figure them out.

Good Luck!

John
Avatar of alpires

ASKER

thanks Johnjces