Opening Ports

L

Luke Davis

I'm looking for an effective way to open and close TCP ports. Can I do
this through Tcpclient? And I know this is a potential security risk, so
what kind of permission must the person running the application possess to
handle it without errors?

--
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com
 
N

Nicholas Paldino [.NET/C# MVP]

Luke,

To what end are you trying to open the ports? Are you saying that you
are trying to open up ports in a firewall? If so, then TcpClient is not the
right class to use.

If you are trying to open ports in a firewall, then how you open those
ports is dependent on the firewall product.

Which is it that you are trying to do?
 
C

Chris Shepherd

Luke said:
I'm looking for an effective way to open and close TCP ports. Can I do
this through Tcpclient? And I know this is a potential security risk, so
what kind of permission must the person running the application possess to
handle it without errors?

Yes, and No, all at the same time. Your question is pretty vague, so it
would help a great deal if you could pin it down a bit better.

Leaving the firewall comments to Nicholas and taking them out of
consideration, opening a port presents no great security risk. Opening a
port that has an application listening on it that is vulnerable to
various attacks presents a security risk.

Semantical discussion aside, you asked about permissions. On Windows,
the permissions that matter in relation to opening ports are whether
you're Administrator/System or not. If you are running as System:
- You can open a listening TCP or UDP socket in the Well-Known port range.
- You can perform raw socket operations (unlikely that you will ever
need this).

This page lists the various port ranges:
http://www.microsoft.com/technet/community/columns/cableguy/cg1205.mspx

As for what to use, assuming still that this is an incoming "server"
type connection you want to open, then TcpListener is probably what
you're looking for. If you want to connect out to another box, TcpClient
should be correct.

Elaborating more on what you are trying to do will definitely get you
clearer responses though.

Chris.
 
L

Luke Davis

Alright, thanks for the advice. I want to automatically open the ports on
the Windows, MacAfree, and Symantec software. So TCPclient will not be
able to do that? It is just good for connecting to a port, but not opening
the firewall. What namespace/class would be good for that type of
operation?
 

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