473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Opening Ports

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
Sep 7 '07 #1
3 3061
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?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Luke Davis" <lu**@gorealco.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
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

Sep 7 '07 #2
Luke Davis wrote:
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/com...uy/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.
Sep 7 '07 #3
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?

"Chris Shepherd" <ch**@nospam.chsh.cawrote in message
news:Oh**************@TK2MSFTNGP05.phx.gbl...
Luke Davis wrote:
>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/com...uy/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.

Sep 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daniel | last post by:
after opening socket, sending data then closing socket 3000 times i get "Only one usage of each socket address" what am i doing wrong? is there some thing else i need to do to free up the socket...
1
by: DavidE | last post by:
Hi, Recently, when I try to open files in web projects with visual interdev 6 I get this error message: Server error: Error 2 opening registry key Software/microsoft/shared tools/web server...
3
by: andyI | last post by:
Where do I find information on how to address and pass data to and from the serial ports and USB ports in VB. VB6 supports the serial ports easily but I see no reference to using the USB ports....
0
by: David | last post by:
I am having trouble with "ACCESS DENIED" error messages in a VB.NET 2003 application when attempting to open serial comms ports. The application has 2 ports that connect via serial cable to 2...
1
by: henrycortezwu | last post by:
Hi All, I'm trying to connect to a virtual port (COM19, OUTGOING, "Bluetooth Serial Port") using VS2005 System.IO.Ports. When I ran the ff code below here's what happens. 1) VS2005 Compiles w/o...
13
by: =?Utf-8?B?Q29ubnVsbA==?= | last post by:
I need to open a Cash Drawer from my Windows App when the user issues and prints (Epson Receipt Printer) a Receipt. I beleive I need to pass the printer a string of (#027 + #112 + #000 + #025 +...
2
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the...
4
by: cmdolcet69 | last post by:
I have the following code: When i run this code it gieve me an error saying the COM port isn;t opened? Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)...
4
by: piscut3 | last post by:
I'm developing a POS with cash drawer integration.But I can't open cash drawer. I have RS232 cable used to connect cash drawer to PC , dot matrix and cash drawer. This cash drawer has no DLL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.