9.3 Connections Collection

Represents the collection of client connections.

9.3.1 Max property

Returns the maximum number of licensed connections for the server.

Syntax

object.Max

Type

Long.

Attributes

Read-only.

Example

This example returns the maximum number of licensed connections for the server.

set srv = CreateObject ("ucx:Server") 
set conns = srv.clients 
     print ("Maximum connections " &conns.max)

9.3.2 Element method

Finds a Connection object in the collection.

Syntax

object.Element( 
   ConnectionId As Integer)

Parameters

ConnectionId

The connection number of the object to find.

Return Values

Connection.

Example

This example returns the specified object in the collection.

’Find the 10th connection and list the connection information 
set srv = createobject ("ucx:Server") 
set conns = srv.Clients 
set Connection=conns.Element(10) 
     print (Connection.Name) &' is the connection object'

9.3.3 HasMoreElements method

Determines whether or not any more Connection objects exist in the collection.

Syntax

object.HasMoreElements()

Parameters

None.

Return Values

Boolean. Returns TRUE if successful; otherwise, FALSE.

Example

This example determines whether or not any more Connection objects exist in the collection.

’Reset the collection and list the connection information 
set srv = createobject ("ucx:Server") 
set conns = srv.clients 
conns.reset 
while (conns.hasmoreelements()) 
     if (Err.Number = 0) Then 
          Print (connection.Name) 
     end if 
wend

9.3.4 Next method

Returns the next Connection object in the collection.

Syntax

object.Next()

Parameters

None.

Return Values

Connection. Returns NULL if the collection has no more elements.

Example

This example returns the next Connection object in the collection.

’Reset the collection and list the connection information 
set srv = createobject ("ucx:Server") 
set conns = srv.clients 
conns.reset() 
while (conns.hasmoreelements()) 
     set Connection = conns.next 
     if (Err.Number = 0) Then 
          Print (Connection.Name) 
     end if 
wend

9.3.5 Reset method

Resets the collection and starts an iteration.

Syntax

object.Reset()

Parameters

None.

Return Values

Void.

Example

This example resets the collection and starts an iteration.

Set srv = CreateObject ("ucx:Server")

’Returns the collection of client connection
Set conns = srv.clients 

’Returns the maximum number of licensed connections 
Print ("Maximum licensed connections is: " &conns.max)

’Find the 10th connection and list the connection information 
Set Connection=conns.Element(10) 
Print (Connection.Name) &" is the connection object for
connection number 10"

’Resets the collection and list the connection information 
conns.Reset() 
While (conns.Hasmoreelements()) 
     Set Connection = conns.Next()
     If (Err.Number = 0) Then 
          Print (Connection.Name) 
     End If 
Wend