IBM OS/2 LAN Server REXX Utility DLL


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


NETSESSION Enumerate


The function retrieves a list of computer names having a session to a 
server.   
Syntax 

MyRc = NetEnumerate(NETSESSION, 'sessionInfo', SrvName)

  
Parameters 
The parameters specified are: 
'sessionInfo'  The REXX variable receiving the result. The variable is 
               divided into: 
   o sessionInfo.0 
     The number of sessions 
   o sessionInfo.i 
     The computer name entry i, where the variable i has a value from 1 to 
     sessionInfo.0 
   o sessionInfo.i.username 
     The name of the userid who established the session 
   o sessionInfo.i.num_conns 
     The number of connections that have been made during the session 
   o sessionInfo.i.num_opens 
     The number of files, devices, and pipes that have been opened during 
     the session 
   o sessionInfo.i.num_users 
     The number of sessions that are established between the server and 
     the requester 
   o sessionInfo.i.time 
     The number of seconds a session has been active 
   o sessionInfo.i.idle_time 
     The number of seconds a session has been idle 
   o sessionInfo.i.user_flags 
     The manner in which the user established the session. The bit mask 
     for user_flags is defined as follows: 
     Value  What
     -----  ----------------------------------------------
      1     Established the session using a GUEST account
      2     Established the session without using password encryption
     
     
     
   o sessionInfo.i.cltype_name 
     The type of client that established the session 
     Type          What
     -----------   ------------------------------------------------
     Down Level    Old clients; for example, LAN Server 1.0 clients
     DLR 2.0       DLR 2.0 clients
     OS/2 LS 1.3   OS/2 LAN Server 1.3 clients
     OS/2 LS 3.0   OS/2 LAN Server 3.0 clients
     OS/2 LS 4.0   OS/2 LAN Server 4.0 clients
     
     
   o sessionInfo.totalentries 
     The total number of entries available. If many entries are avaiable 
     the number of entries returned (sessionInfo.0) is not identical to 
     the total numbers available 
SrvName        The server computer name 
  
Note 
The server computer name can be specified as '' for a local server. 
Example   

/* List computer names having a session to a server */
call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs'
call LoadLsRxutFuncs

NETSESSION = 180
SrvName    = '\\DOMAIN_CONTRLR'

myRc = NetEnumerate(NETSESSION, 'sessionInfo', SrvName)

if myRc <> '0' then do
 say 'Got error from NetEnumerate() ' myRc
 call DropLsRxutFuncs
 exit 9
end

if sessionInfo.0 = 0 then do
 say 'No session established on server'
 call DropLsRxutFuncs
 exit 0
end

say 'Number of computers having a session to server: ' sessionInfo.0
say

do i=1 to sessionInfo.0
 say sessionInfo.i
 say sessionInfo.i.username
 say sessionInfo.i.num_conns
 say sessionInfo.i.num_opens
 say sessionInfo.i.num_users
 say sessionInfo.i.time
 say sessionInfo.i.idle_time
 say sessionInfo.i.user_flags
 say sessionInfo.i.cltype_name
 say
end

call DropLsRxutFuncs
call RxFuncDrop 'LoadLsRxutFuncs'

exit 0

  
Example Output   

Number of computers having a session to server:  1

ITSCWK21
ADMIN04
4
2
1
14956
0
0
OS/2 LS 3.0



Inf-HTML End Run - Successful