query the service name by port number

Hi all,

is there an API for retrieving the service name by a given port number
(example: 143 -> 'imap', 110 -> 'pop3'), or do I have to parse
C:\Windows\system32\drivers\etc\services
by myself?

TIA
Achim
0
Achim
1/21/2012 6:48:34 PM
embarcadero.delphi.nativeapi 1236 articles. 1 followers. Follow

2 Replies
814 Views

Similar Articles

[PageSpeed] 26

"Achim Kalwa" <spamcollector@achim-kalwa.de> schrieb im Newsbeitrag 
news:438913@forums.embarcadero.com...
> Hi all,
>
> is there an API for retrieving the service name by a given port number
> (example: 143 -> 'imap', 110 -> 'pop3'), or do I have to parse
> C:\Windows\system32\drivers\etc\services
> by myself?
>
> TIA
> Achim

Hi,

Call
struct servent FAR * getservbyport (
    int port,
    const char FAR* proto
   );
with the port and proto = NIL and read s_name from
struct servent {
    char FAR *        s_name;
    char FAR * FAR *  s_aliases;
    short             s_port;
    char FAR *        s_proto;
};

Heiner
0
Heinrich
1/22/2012 9:22:46 AM
Hello,

Heinrich Wolf wrote:
> Call
> struct servent FAR * getservbyport (
>     int port,
>     const char FAR* proto
>    );
> with the port and proto = NIL and read s_name from
> struct servent {
>     char FAR *        s_name;
>     char FAR * FAR *  s_aliases;
>     short             s_port;
>     char FAR *        s_proto;
> };

thank you, it works.

Achim
0
Achim
1/22/2012 2:55:47 PM
Reply:

Similar Artilces:

How to get Hostname, IP address, port number, DB name, instance name using Query
As we know, normally we connect to a sybase server by just identifying the node name and interfaces file and necessary properties, but currently I want to get Host-name, IP address, port number, DB name, instance name of connected server out after connection created. Does any one how to use query to do so? Does sybase provide such functionality? Seems oracle can do so... If there is no query, does sybase provides any API which can implement this? Thanks! instance name: select @@servername [assumes the DBA has defined a local entry in syservers] db name: select db_name() [can...

To use Naming Service...or not to use Naming Service?
That is my question. I want to use clustering and load balancing on my jag servers, so I'm not sure if I need to do this or if the connection object handles this "behind the scenes". In PB does the connection object use the nameservice to do this for you, or do you have to use the JaguarORB.Resolve_Initial_References(), and narrow everything down to the component to take advantage of this? What is "the best way" to instantiate Jag components in PB if you want clustering, fail-over, and load balancing? Thanks for any help. Erik T. The connection ...

Simple Naming Service Query
I can't seem to be able to set-up the Naming Service example in the Sys Admin manual (Chapter 2: Jaguar Naming Services). The 'Name binding' example has Servers A, B and C - with Server C as the Name Server. It says to assign Server A an Initial Context of /us/sybase/serverA - this I can do, as I can see where to type in this value. It then says designate Server C to be the Name Server for Server A by specifying the URL for Server C (iiop://myhost:9050) in itsNaming Services properties - THIS I CANNOT LOCATE. I have disabled Server A as Name Server, and Server C is e...

Web Services and Port Numbers
Hello all,      This is the second time I've typed this because I closed out the browser the first time. Don't you hate that. Doh! Anyways here's my issue. I have a web service that I'm creating that will allow me to access our companies SQL Server which is behind a firewall from our web server in a remote location. I've asked my Network admin to open a port for me to use, which he did and you can access the web service via a browser in the form: ' http://[ip]:[port]/webservice/service.asmx ' however, when I try to add a web reference in my VS.Net 2005 project it fa...

Why port number on task bar was different from port number with URL?
Hi, When I test my simple program (one or two page), the port displayed in URL will keep same with one session.But the ASP.NET Development Server port displayed on task bar kept changing or disappeared. This  prevented  page from accessing.How this happen and how can I fix this error? Thanks in advance. Since the asp.net2.0 has internal web server... so it would be not possible to say what the port number would be.... So it would be a best way to use the system name... say., if u run in the same machine (localhost) - use - http://localhost/12345.aspxPlease remember to click ...

How to make website accessible to only particular port numbers? How to create such port numbers?
Hi, How to make website accessible to only particular port numbers? How to create such port numbers? Swati you dont have to handle this with handlers...you can set this in IIS.......

Port numbers for Web Service apps
Just porting my 2003 web svc projects to vs2005.  I can run the service in the debugger without deploying to iis cool.  But how can I stop random ports being assigned cos my test client needs to change it time it does so.  Can I fix the port for a project ? While Creating the Web App / Web Service use Location as HTTP rather than using "File System".Somnath Mali.NET Developer , Pune INDIA.Please Mark As Answer If my reply helped you. Hi RyeLoaf, If you want to assign a fixed port number for debugging, please refer to the following steps:   &...

how to get rid of port number in domain name
hi I have a web site configured on iis. and it was not nesseccery to type the port of the web site when the port was 80. but after installing microsoft sharepoint server it used port 80 so I have changed my website port to 90. then I have to type the port after domain (http://domain:90) and when I dont type the port like (http://domain) then share point will come!!!! how can I get ride of typing port number? is the some settings in IIS??? regards Any time you use a non-standard port, other than 80, it has to be specified on the URL.  That's the way it works on every web server.&...

Port number selection and "service" selection
Hi, I am planning to add a console-based, IP supported "status and control" protocol/function to my application. First, if you check the "Common port number use" lists on the internet the port numbers are all busy, how do I choose a port number that will most likely work? Second, if I want to add some Telnet-similar, console interface do I have to create the full port connect, use and disconnect handshake protocol myself or is there a good component available that handles all that and provides me with a simple "CR/LF terminated line received" event...

Domain Name Search / Whois Query through Web Service
Hi! I am currently on a lookout for a webserivce providing real-time domain name search / whois query or any such method. Please help! Zubair...

Query.cgi "Search" removes port number
I am using Bugzilla 3.4.4 on Windows 2003, IIS and Active Perl. My IIS server is on the standard http port 80, but my router maps another port for outside connection to forwward to this server on port 80. For example the outside url is http://host.mycompany.com:5555/Bugzilla which forwards to my server at port 80. Mostly Bugzilla handles this fine EXCEPT Advanced Search. When it goes to query.cgi, it makes the submit url WITHOUT the port: http://host.mycompany.com/Bugzilla/buglist.cgi...... when it should be: http://host.mycompany.com:5555/Bugzilla/buglist.cgi.... (if I add t...

Microsoft SERVICES FOR UNIX "User Name Mapping" ports
ShieldsUp reported ports 872 and 874 open on my Windows XP Professional computer, but did not list what might be using these ports. Based on NetStat and Task Manager, it appears these ports are being used by Microsoft's SERVICES FOR UNIX "User Name Mapping" service. "Matthew Seitz" <mseitz@yahoo.com> wrote in message news:bj93vv$lqt$1@news.grc.com... [] > Based on NetStat and Task Manager, it appears these > ports are being used by... [] Pray tell... how did you garner that info from using netstat (in a command line) and Task Manager (in Win...

Common Ports .vs. All Service Ports
Why are ports 1025, 1026 and 1028 shown as open when I run the Common Ports test, and Stealth when I run the All Service Ports Test, or single port probe?? I am just trying to figure out if they are open or not. I just started evaluating tiny personal firewall, so I am checking to see if it is working properly..... I made the switch from ZoneAlarm because I want to be able to allow traffic on my ftp server port. Thanks, Steve Steve Stadler <sstadler@incircuits.com> wrote: > Why are ports 1025, 1026 and 1028 shown as open when I run the Common > Ports test, an...

Can a service know its service name programatically
Hi all, I know that you can name a service if using TService but if I install a BCB6 service with say, svcinst.exe and give it an arbitrary service name like, firstservice, then how can that service app know that it has been launched as firstservice from the SCM. Short of passing the service name as a parameter, I dont think you can. When a service first starts, it must call StartServiceCtrlDispatcher() with a SERVICE_TABLE_ENTRY parameter / array. This structure must contain the name of the service i.e. firstservice. I guess when you first install the service, you could assig...

Web resources about - query the service name by port number - embarcadero.delphi.nativeapi

Public Broadcasting Service - Wikipedia, the free encyclopedia
... such as PBS NewsHour , Masterpiece , and Frontline . Since the mid-2000s, Roper polls commissioned by PBS have consistently placed the service ...

China Mobile creates dedicated unit to grow its internet services revenues
Zee News China Mobile creates dedicated unit to grow its internet services revenues Rethink Research (subscription) Many large mobile operators ...

The Beatles music reportedly coming to one streaming service on Christmas Eve
When Apple Music launched back in June, it was noted that the music subscription service didn’t offer up the entire iTunes catalog with a few ...

Target is taking on Apple Pay with its own mobile wallet service
... Of course, we’ll keep you posted with further information as we receive it. Target is taking on Apple Pay with its own mobile wallet service ...

Growth in Service PMI Shrinks Sharply
On Friday, the PMI Flash Services reading registered growth that fell sharply, not only well below the Econoday Consensus estimate of 56.1, but ...

2015’s top e-learning and web services offers at Cult of Mac Deals
‘Tis the season to take advantage of soon-to-end deals, and boy have we got some good ones. These are the top five deals of the year on comprehensive ...

The Beatles may hit streaming music services by Christmas
The Beatles haven't exactly been in a rush to embrace the online music world there's iTunes, Rock Band and that's about it. However, they might ...

FreeConferenceCall.com Adds Video to Collaboration Services
The company's new conferencing tool includes such capabilities as screen sharing and a feature that focuses participant attention on presenters. ...

An Interactive Map Of The Wireless Service In Disney's Magic Kingdom
A map of where to get the best signal in the Most Magical Place on Earth.

Enterprise and midsize customer service solutions
When looking to purchase a customer service solution, buyers have to remember that more features is not better; many times more is just more. ...

Resources last updated: 12/21/2015 9:44:08 AM