Blocking Windows Port using C#

V

VeryMaqbool

Does anyone know of a way, using C#, to programmatically block a
Windows port?
Futhermore I want to know how can we map processes to the ports opened
on a computer using C# and without using existing softwares...
can anyone suggest some techniques...
Regards...
Very.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

VeryMaqbool said:
Does anyone know of a way, using C#, to programmatically block a
Windows port?

No, there is no way of doing that, you need to have a firewall installed and
be able to configure it from your code. Now I would explore the possibility
of using WMI on a XP SP2 machine, maybe you can use it.
But again, if the user has the firewall disable you can do nothing.
Futhermore I want to know how can we map processes to the ports opened
on a computer using C# and without using existing softwares...
can anyone suggest some techniques...

Not clear what you want, could you be more explicit?
 
J

justin creasy

Does anyone know of a way, using C#, to programmatically block a
Windows port?
Futhermore I want to know how can we map processes to the ports opened
on a computer using C# and without using existing softwares...
can anyone suggest some techniques...
Regards...
Very.

I was trying to do something similar to this a year or so ago and was
very disappointed. There is no documented way to do this on a high
level in Windows. The only possible solution I found was to write your
own device driver that can sit on the network adapter and filter
traffic. This solution was more work than it was worth for me so I
never followed through on it. If you find more information please post
back here on it. Good luck.
 
V

VeryMaqbool

Futhermore I want to know how can we map processes to the ports opened
on a computer using C# and without using existing softwares...
can anyone suggest some techniques...

By this I mean... I want to find out which process or which .exe file
is sending/recieving data on which port...


Thanks for your concern....
Hope to see more suggestions...

Regards..
Very.
 
W

Willy Denoyette [MVP]

VeryMaqbool said:
By this I mean... I want to find out which process or which .exe file
is sending/recieving data on which port...


Thanks for your concern....
Hope to see more suggestions...

Regards..
Very.


netstat.exe -a -b

Willy.
 
V

VeryMaqbool

I found a command line utility (fPort) for finding open ports on a
computer and thier associated processes..
and the one for blocking and unblocking the ports....

My point is.. Can these utilities be invoked in a C# program....???If
not then is their some other way of doing these in C#...???

Regards,
Very..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top