nucm-logo

NUCM-2.0 Documentation
Interface: Miscellaneous: nc_ping


[Distribution | Miscellaneous | Access]

[nc_ping | nc_shutdown]

Signature

int  nc_ping(const t_server*  server)

Functionality

Determines whether the NUCM server addressed by the parameter server is up.

Return Values

1: everything went ok and the server is up
0: everything went ok and the server is not up
-1: an error occurred

NdbErrno Codes

NdbOk :everything went ok
NdbConnect :the server is down or not reachable
NdbComm :a communication error occurred
NdbProtocol:a failure occurred in the NUCM protocol
NdbNotAvail:service is not available

Example

To see whether an access server is active on a machine "serl.cs.colorado.edu" and is listening to port "1234", the following code fragment can be used:
   #include "nc.h"

   t_server  server;

   strcpy(server.host, "serl.cs.colorado.edu");
   sprintf(server.port, "%d", NUCM_PORT);
   if ((running = nc_ping(&server)) == -1) {
      fprintf(stderr, "nc_ping failed\n");
   } else if (running) {
      printf("server %s, %d is running\n", server.host, server.port);
   } else {
      printf("server %s, %d is not running\n", server.host, server.port);
   }
Note that port "1234" is the default port a NUCM access server listens to, so we use the NUCM_PORT macro to set it in the variable server.

[Top | Quick Index] [Concepts | Interface]

SERL <serl.cs.colorado.edu>