473,386 Members | 1,810 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,386 software developers and data experts.

How do I get port number from etc/services?

Hi,

I need to bind a socket to a port that's specified in the
C:\windows\system32\drivers\etc\services file. Is there a
GetPortByServiceName() method in C#? If not, does anyone have any
suggestions on how best to do this?

Thanks,
John
Nov 16 '05 #1
1 4046
Hi,

AFAIK there is not such a method, what you can do is read the
C:\windows\system32\drivers\etc\services file and parse it as needed. you
know that the format of a line is \d+\s+\w+

you will have to modify the \w+ part to include the service you want,
something like
"\w*" + ServiceName + "\w*"

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"John" <jo********@hotmail.com> wrote in message
news:d8**************************@posting.google.c om...
Hi,

I need to bind a socket to a port that's specified in the
C:\windows\system32\drivers\etc\services file. Is there a
GetPortByServiceName() method in C#? If not, does anyone have any
suggestions on how best to do this?

Thanks,
John

Nov 16 '05 #2

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

Similar topics

0
by: db2group88 | last post by:
Hi, recently i install oracle 10g server on windows pc, but some of the services take port number 8080 which is conflict with our application server port, is there anyway to change those services...
1
by: RWC | last post by:
Hello, I have SQL Server 2000 Enterprise Edition, and I'd like to change the default port to something else (we'll use 2033 for this example). I've tried to connect from another computer on the...
2
by: Tom | last post by:
I've done this before, but apparently I didn't keep my notes.. I have DB2 Personal Edition on my Windows XP box to talk to our DB2 database on our AS/400. This HAS been working fine. Until this...
3
by: Keith | last post by:
Quick question on port numbers (V8.1 or V8.2): Is it true that on HP11, db2icrt command ignores -p option for port (Non DPF)? Does DB2 always take 60000 (assuming this is the first instance), ...
2
by: r_stringer66 | last post by:
Hi all, How can I find out which port my db2 database is running on on an aix machine? I need to supply the port number to my JDBC connection string. Any response is greatly appreciated. ...
2
by: Mockey Chen | last post by:
I want to get my db2 instance's listen port, is there any command to retrieve this information? -- Regards. Mockey Chen Email: mockey.chen@gmail.com
1
by: JT | last post by:
Hi, We have 2 servers having the same web site running on port 8080. These two servers are load balanced and have DNS name, e.g. my.server.com. Now on both of these two servers, we put the same...
6
by: db2_d_b_a | last post by:
Hi Guys, Could some one share with me some information on the Interrupt port being used in DB2. Whats the significance of this port in both EE and EEE environments.
0
by: Marcel Overweel | last post by:
Hi, I'm developing a set of services for a software solution. It will be broken down in several application including a few windows services. It is very likely that most of these services...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.