Dear oh dear.
That reply from Mark Savory is utter coblers.
How is an API platform specific !
Rubbish.
How is looking up a service by name any different to looking up a host by name. In each case the client has a symbolic name and also in each case the client uses an api to connect to a local (eg file) or network (eg DNS or NIS) resource to tranlate the name to ip address or port number.
There are so many complete Java heads out there whose only experience is the JDK and a few other services. They know so little but are quite happy to sound off.
One Java'esque way to emulate the very handy netdb functions would be to define an interface that looks much like the netdb api for getservbyname() etc and then implement this interface with a class that either reads a config file (eg on unix /etc/services) and/or uses JNDI with the NIS adapter to contact NIS.
I've got a getservbyname() implementation that uses a NIS - I'll dig it out.
I have seen so any Java networking program that hard code port numbers despite the fact that they operate in an environment where programs written in perl / c / c++ etc use netdb in order to be more flexible. Very sad but simply a symptom of the narrow spectrum of experience of so many Java 'programers'.
[ July 03, 2003: Message edited by: JL Junk ]