You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jörg Schaible <Jo...@scalaris.com> on 2012/04/02 16:41:45 UTC

getservbyname

Guys,

do we have somewhere an equivalent for the C system call getservbyname in 
commons?

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: getservbyname

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Emmanual,

Emmanuel Bourg wrote:

> Le 02/04/2012 18:13, Jörg Schaible a écrit :
> 
>> Right. Best would be a system call, but I can also live with some
>> functionality that parses the etc/services in Linux/Windows directly. For
>> support in the Java runtime I only found a 15 year old enhancement
>> request in Oracles Bugzilla ... :-/
> 
> It should be easy to do this in a platform independent manner by parsing
> the IANA port database:
> 
> http://www.iana.org/assignments/service-names-port-numbers/service-names-
port-numbers.xml
> 
> That's the authoritative source for port names.

This is useless, you will need the current settings of the system. It is not 
uncommon in large companies to modify the "official" mappings, remove 
unwanted or add private ones.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: getservbyname

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 02/04/2012 18:13, Jörg Schaible a écrit :

> Right. Best would be a system call, but I can also live with some
> functionality that parses the etc/services in Linux/Windows directly. For
> support in the Java runtime I only found a 15 year old enhancement request
> in Oracles Bugzilla ... :-/

It should be easy to do this in a platform independent manner by parsing 
the IANA port database:

http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml

That's the authoritative source for port names.

Emmanuel Bourg


Re: getservbyname

Posted by sebb <se...@gmail.com>.
On 2 April 2012 17:13, Jörg Schaible <jo...@gmx.de> wrote:
> Hi Emmanuel,
>
> Emmanuel Bourg wrote:
>
>> Le 02/04/2012 16:41, Jörg Schaible a écrit :
>>
>>> do we have somewhere an equivalent for the C system call getservbyname in
>>> commons?
>>
>> You mean something that map a service name (http, ssh) to a port number
>> (80, 22) ?
>
> Right. Best would be a system call, but I can also live with some
> functionality that parses the etc/services in Linux/Windows directly. For
> support in the Java runtime I only found a 15 year old enhancement request
> in Oracles Bugzilla ... :-/

It looks as though Tomcat Native has access to the C routine via JNI,
but it would be nice to have a pure Java implementation.

Sounds like a suitable enhancement for Commons NET?

> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: getservbyname

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Emmanuel,

Emmanuel Bourg wrote:

> Le 02/04/2012 16:41, Jörg Schaible a écrit :
> 
>> do we have somewhere an equivalent for the C system call getservbyname in
>> commons?
> 
> You mean something that map a service name (http, ssh) to a port number
> (80, 22) ?

Right. Best would be a system call, but I can also live with some 
functionality that parses the etc/services in Linux/Windows directly. For 
support in the Java runtime I only found a 15 year old enhancement request 
in Oracles Bugzilla ... :-/

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: getservbyname

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 02/04/2012 16:41, Jörg Schaible a écrit :

> do we have somewhere an equivalent for the C system call getservbyname in
> commons?

You mean something that map a service name (http, ssh) to a port number 
(80, 22) ?

Emmanuel Bourg