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

Who is Participating?
JohnjcesConnect With a Mentor Commented:
Here is a link to Delphi code to display all of your connections like netstat. As afar as killing them, that is mor eproblematic.

Maybe this will get you going anyway. or


alpiresAuthor Commented:
Johnjces I downloaded the program 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?

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!

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

alpiresAuthor Commented:
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.


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 ! Thank you!
Se vuoi dare un contributo allo sviluppo di questo programma scrivi a ! Grazie!

Salvatore Meschini


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.


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: and download from there    and

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!

alpiresAuthor Commented:
thanks Johnjces
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.