Solved

Blocking ports

Posted on 2003-10-26
8
550 Views
Last Modified: 2007-12-19
How can i block ports using delphi and have the ability to turn them back on or off.

Also how can i monitor the connections on the computer like netstat

Thanks,
Hypoviax
0
Comment
Question by:Hypoviax
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 6

Expert Comment

by:swift99
ID: 9624989
You are talking about either (a) writing a firewall program, or (b) writing a TCP Proxy program.

If (a), then you need to learn tier 0 and tier 1 Windows system programming.  Most of the books on this are written for C programmers, but if you're up to this particular task the programming language won't really matter to you.  A faster, cheaper, and more reliable alternative would be to pick up a linux installation and use the linux OS provided tools. Why re-invent something that is core functionality of a free (or at least really cheap) tool?

if (b), then I suggest picking up ICS at http://overbyte.delphicenter.com  .  The entire suite is written from the ground up in Delphi, and there are even examples of functional proxies on the "user built" page that you could use as a starting point.
0
 
LVL 8

Expert Comment

by:gmayo
ID: 9625634
Or (c) you just want to block the ports. The easiest way is to simply dump a TServerSocket or TTCPServer or equivalent on to your form, set the port number to the one you want to block, and then activate it. Only one application can listen on a port so the port must be free for you to attach to.

There is a netstat-like component on http://www.torry.net/networks.htm (second one down).

Geoff M.
0
 
LVL 2

Expert Comment

by:123456
ID: 9626801
hi , i see a question as same as your question

see this link may be useful for you
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20751854.html#9493226

regards

0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 5

Author Comment

by:Hypoviax
ID: 9647236
Gmayo

I will have a look at your component. It is i think what i am looking for.

In regards to your other suggestion will this work if there already is a connection present on the port.

To Swift99

I am creating a security application that at the moment is very good at the desktop level, dealing with programs and files etc, however i need it so that it can control network flow in a way like a firewall but as gmayo said, all, at the moment that i want to do is block a specified port.
0
 
LVL 8

Expert Comment

by:gmayo
ID: 9648492
You won't be able to take over the port if something else already has it. However, I think the netstat is independant of the ports and won't actually block anything, just monitor it. If something else has grabbed the port before your app starts then you probably need to start at a service level, ie when Windows starts.

Geoff M.
0
 
LVL 5

Author Comment

by:Hypoviax
ID: 9655108
gmayo,

If this is so then i am satisfyed however, how will it be possible to apply a TServerSocket etc on more than one port. Is it possible to create a socket for each port? If so how is this done.

Also the component you are suggesting will not work for me. I am missing vcl30.bpl. It is not located in the delphi bin directory.

Thanks,

Hypoviax
0
 
LVL 8

Accepted Solution

by:
gmayo earned 250 total points
ID: 9656133
You will need one TServerSocket per port to be blocked. Set the port number and Active flag.

I can't help with the vcl30.bpl - does the component you want come with source code so you can rebuild it? Basically, whatever you were trying to use was compiled under Delphi 3.

Geoff M.
0
 
LVL 5

Author Comment

by:Hypoviax
ID: 9664759
Thanks for your help Geoff,

Hypoviax
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

623 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