home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / conlst.exe / CONNLIST.C < prev    next >
C/C++ Source or Header  |  1994-09-29  |  2KB  |  57 lines

  1.  
  2. /****************************************************************************
  3. **        DISCLAIMER
  4. **
  5. **    Novell, Inc. makes no representations or warranties with respect to
  6. **    any NetWare software, and specifically disclaims any express or
  7. **    implied warranties of merchantability, title, or fitness for a
  8. **    particular purpose.
  9. **
  10. **    Distribution of any NetWare software is forbidden without the
  11. **    express written consent of Novell, Inc.  Further, Novell reserves
  12. **    the right to discontinue distribution of any NetWare software.
  13. **
  14. **    Novell is not responsible for lost profits or revenue, loss of use
  15. **    of the software, loss of data, costs of re-creating lost data, the
  16. **    cost of any substitute equipment or program, or claims by any party
  17. **    other than you.  Novell strongly recommends a backup be made before
  18. **    any software is installed.   Technical support for this software
  19. **    may be provided at the discretion of Novell.
  20. ****************************************************************************
  21. #include <stdio.h>
  22. #include <string.h>
  23. #include <alloc.h>
  24. #include <nwcalls.h>
  25.  
  26. void main (void)
  27. {
  28.     NWCONN_HANDLE     connHandle;
  29.     NWCONN_HANDLE     *connList;
  30.     CONNECT_INFO     connInfo;
  31.     NWNUMBER    maxConns, numConns;
  32.     NWCCODE        ccode;
  33.     char         server[50];
  34.     int            i;
  35.  
  36.     ccode = NWCallsInit (NULL,NULL);
  37.     if (ccode) return;
  38.  
  39.     NWGetMaximumConnections (&maxConns);
  40.     connList = malloc (maxConns * sizeof (NWCONN_HANDLE));
  41.  
  42.     ccode = NWGetConnectionList (0, connList, maxConns, &numConns);
  43.     if (ccode)
  44.     {
  45.         free (connList);
  46.         return;
  47.     }
  48.  
  49.     printf ("\nYou are connected to %d servers\n", numConns);
  50.  
  51.     for (i = 0; i < numConns; i++)
  52.     {
  53.         NWGetFileServerName (connList[i], server);
  54.         printf ("ID:  %04X  Server:  %s\n", connList[i], server);
  55.     }
  56.     free (connList);
  57. }