GetConnectionInformation

Returns information about the object logged in as the specified connection number

Local Servers:nonblocking
Remote Servers:blocking
Classification:3.x, 4.x, 5.x, 6.x
Service:Server-Based Connection

Syntax

  #include <nwconn.h>  
   
  int GetConnectionInformation (  
     WORD   connectionNumber,  
     char   *objectName,  
     WORD   *objectType,  
     long   *objectID,  
     BYTE   *loginTime); 
  

Parameters

connectionNumber
(IN) Specifies the server connection number for which information is to be returned (0 to maximum connection number).
objectName
(OUT) Receives a string containing the name of the object logged in at the connection number (maximum 48 characters, including the NULL terminator).
objectType
(OUT) Receives the type of the object that is logged in at the connection number (OT_USER, OT_USER_GROUP, OT_PRINT_SERVER).
objectID
(OUT) Receives the unique ID of the object that is logged in at the connection number (0 = unused logical connection number).
loginTime
(OUT) Receives the date and time that the object logged in at the connection number (7 bytes).

Return Values

The following table lists return values and descriptions.

Value

Hex

Name

0

(0x00)

ESUCCESS

Remarks

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:

Byte

Contents

 

0

Year

(0 to 99, where a value of 80 = 1980, 81 = 1981, etc.; however, if the value is less than 80, the year is considered to be in the twenty-first century.)

1

Month

(1 to 12)

2

Day

(1 to 31)

3

Hour

(0 to 23)

4

Minute

(0 to 59)

5

Second

(0 to 59)

6

Day

(0 to 6, where a value of 0 = Sunday, 1 = Monday, etc.)

See Also

GetConnectionList, GetConnectionNumber, GetInternetAddress, GetMaximumNumberOfStations, GetObjectConnectionNumbers, GetStationAddress

GetConnectionInformation Example

  #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;  
        }  
     }  
  }