* Problem with getservbyname () and NIS.
@ 1992-05-19 14:22 Bill Crooke
0 siblings, 0 replies; only message in thread
From: Bill Crooke @ 1992-05-19 14:22 UTC (permalink / raw)
Hi, I am having a problem with getservbyname () on a DECstation 3100
running Ultrix 4.1.
I have edited /etc/svc.conf to include the line "services=local,yp".
When I run "ypcat services | grep vnsd I get the following string
vnsd 2713/tcp vnsd
Yet when I run the program below the error message "error: service
not in /etc/services" is printed out.
The only way to get this program to do what I would like is to edit
the /etc/services file, while I would prefer to manage this with NIS.
Am I doing something wrong ? Is there some way I could get around
this ?
If anyone has any advice I would be very grateful.
Thanks Bill Crooke
bcrooke@viewlogic.com
Viewlogic Systems, Inc.
293 Boston Post Rd West
Marlboro, MA 01752-4615
508-480-0881 Ext 421
___________________________________________________________________________
#include <stdio.h>
#include <netdb.h>
main (argc, argv)
int argc;
char **argv;
{
struct servent *serv; /* Service entity */
serv = getservbyname ("vnsd", "udp");
if (serv != NULL) {
printf ("%s\n", serv->s_name);
printf ("%d\n", serv->s_port);
printf ("%s\n", serv->s_proto);
}
else {
printf ("error: service not in /etc/services\n");
}
}
--
Bill Crooke
bcrooke@viewlogic.com
Viewlogic Systems, Inc.
293 Boston Post Rd West
Marlboro, MA 01752-4615
508-480-0881 Ext 421
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1992-05-19 14:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1992-05-19 14:22 Problem with getservbyname () and NIS Bill Crooke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox