[Previous] [Contents] [Index] [Next]


Advertise, lookup and use (connect) a service across a network


gns [-cv] [nodename ...]
gns [-sv] [nodename ...]


Running in client mode. This is the default.
Running in server mode.
A node running a GNS server.


The global name service (gns) manager is a standalone resource manager. With the help of gns, an application could advertise, look up, and use (connect) a service across network, without knowing the detail of where the service is, or who is the provider.

GNS runs in 2 different modes: server and client. A server-mode manager is a central database that stores advertised services, and, handles lookup and connect requests. A client-mode manager relays advertise, lookup, and connect requests between a local application and the gns server.

There are several functions in the Library Reference which you can use: name_attach() to advertise, name_open() to connect to, and name_close() to disconnect from a certain service.

Special pathname

All GNS managers are registered as /dev/name/gns_server or /dev/name/gns_client. This path name can provide some statistical information about the GNS manager. For example:

$ cat /dev/name/gns_client
Global Name Service Mode:    Client
                  Server:    xtang (connected)

Registered services:
   net/netsrv.ott.qnx.com/0,1818649,1,0,-1     (No Expiration)
   network/tcpip/51,20533309,1,0,12            (Fri Feb  7 13:57:39 2003)
   printer/ps/techpub/0,1826845,1,0,12         (No Expiration)

From the above, we infer that the gns is a client, it has only one server (the machine named xtang), and it's already connected to the server. This also lists all the services known to the GNS manager. Note that the network/tcpip service has an expiration time, suggesting that this is a cached entry resulting from querying the gns server.


A typical network with gns looks like this:

Server node:

# gns -s

Client(s) node:

# gns -c server1 server2

See also:

name_attach(), name_close(), name_open() in the Library Reference.

Configuring the Global Name Service Manager in the Neutrino Technotes.

[Previous] [Contents] [Index] [Next]