TCP/UDP connections

Posted on 2009-04-30
Last Modified: 2013-12-03
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

Question by:alpires
    LVL 18

    Accepted Solution

    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



    Author Comment

    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?

    LVL 18

    Expert Comment

    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!


    Author Comment

    Please do it for me, if you want I can open another question to give you another 500 points
    LVL 18

    Expert Comment

    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.

    LVL 18

    Expert Comment


    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.

    {$R WINXP.RES} // Thanks to TMSSOFTWARE -

    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!


    Author Comment

    thanks Johnjces

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    732 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

    23 Experts available now in Live!

    Get 1:1 Help Now