Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 552
  • Last Modified:

Blocking ports

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
Hypoviax
Asked:
Hypoviax
1 Solution
 
swift99Commented:
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
 
gmayoCommented:
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
 
123456Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
HypoviaxAuthor Commented:
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
 
gmayoCommented:
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
 
HypoviaxAuthor Commented:
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
 
gmayoCommented:
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
 
HypoviaxAuthor Commented:
Thanks for your help Geoff,

Hypoviax
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now