GetConnectionInformation
Returns information about the object logged in as the specified connection number
#include <nwconn.h> int GetConnectionInformation ( WORD connectionNumber, char *objectName, WORD *objectType, long *objectID, BYTE *loginTime);
The following table lists return values and descriptions.
The connectionNumber is the position in the File Server Connection Table. A connection number of 0 is a special case. When 0 is specified, objectName returns the server name, objectType returns OT_FILE_SERVER, objectID is the supervisor’s object ID, and loginTime is all zeros.
The objectName is an ASCIIZ string from 1 to 47 characters long.
The objectType identifies the object as an OT_USER (0x0001), OT_USER_GROUP (0x0002), OT_PRINT_SERVER (0x0007), and so on.
The objectID is the unique identification number of the object that is logged in at the logical connection number. (An object ID number of 0 means that an object is not logged in on the specified logical connection number.) This number uniquely identifies the object within the NetWare® Directory.
The loginTime is the date and time at which the object logged in. The 7 bytes contain the following information:
GetConnectionList, GetConnectionNumber, GetInternetAddress, GetMaximumNumberOfStations, GetObjectConnectionNumbers, GetStationAddress
#include <stdio.h> #include <nwconn.h> main() { int completionCode; WORD objType, conn_no; char objName[48]; long objID; BYTE loginTime[7]; printf ("Enter connection number: "); scanf ("%u", &conn_no); completionCode = GetConnectionInformation (conn_no, objName, &objType, &objID, loginTime); if (completionCode != 0) printf ("Error %d in GetConnectionInformation\n", completionCode); else { printf ("Connection Number... %d\n", conn_no); printf ("Object Name... %s\n", objName); printf ("Object Type... %u\n", objType); printf ("Object ID... %ld\n", objID); printf ("Login Date... %d/%d/%d\n", loginTime[1], loginTime[2], loginTime[0]); printf ("Login Time... %d:%d:%d\n", loginTime[3], loginTime[4], loginTime[5]); switch (loginTime[6]) { case 0: printf ("Login Day... Sunday\n"); break; case 1: printf ("Login Day... Monday\n"); break; case 2: printf ("Login Day... Tuesday\n"); break; case 3: printf ("Login Day... Wednesday\n"); break; case 4: printf ("Login Day... Thursday\n"); break; case 5: printf ("Login Day... Friday\n"); break; case 6: printf ("Login Day... Saturday\n"); break; default: printf ("Invalid day\n"); break; } } }