• Post Reply Bookmark Topic Watch Topic
  • New Topic

getservbyname API in Java  RSS feed

 
Alex Iordache
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there an API in Java parallel to the C getservbyname, that accepts a service name and returns the port number?
Do not tell me about InetAddress class because what I need is to get the port number of a service (from /etc/services).
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which would be an operating specific thing to do - Java avoids such things.
 
Dan Anderson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a method to search the /etc/services file
(or /etc/services or c:\winnt\system32\drivers\etc\services).


It is at
<A HREF="http://www.dan.drydog.com/java/GetServiceByName.java</a rel="nofollow">" TARGET=_blank>http://www.dan.drydog.com/java/GetServiceByName.java


With all due respect, this is not a system-dependent
function. The implementation may be (such as the location of
the /etc/services file or whether it's a flat file or database),
but the function can be implemented on any system.
 
JL Junk
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Re Cindy Glass
More Java-head nonsense
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!