Manages the list of client connections.
Determines the number of client connections on the server.
object.Count()
Long.
Read-only.
This example determines whether the number of client connections on the server is greater or less than zero, and acts accordingly.
’Usage: Run this sample, make client connections
’Display client information
sub srvskt_conns_reset
set csrstsrv=CreateObject("UCX:NWSrvSkt")
csrstsrv.Port = 8080
csrstsrv.Protocol = TCP
csrstsrv.Listen = True
’Wait in infinite loop for client connections
Print "Listening for client connections "
Set cs = csrstsrv.Clients
while true
if (cs.count > 0) Then
cs.reset
while (cs.hasmoreelements())
set conn = cs.Next()
print ("Address: "&conn.Address &" Port: " &conn.port)
Wend
End if
Wend
End Sub
Finds the specified client connection object.
object.Element(
Index As Variant,
[,Port As Long])
A long index or address of the client to find.
Optional. The port number of the client connection to find.
Connection. Returns a client connection object with the specified address and port.
This example finds the client connection with the index of 0.
’Usage: Run this sample, make client connections
’Display client information for the first client
Sub srvskt_conns_element
set csrstsrv=CreateObject("UCX:NWSrvSkt")
cselesrv.Port = 8080
cselesrv.Protocol = TCP
cselesrv.Listen = True
’Wait in infinite loop for client connections
Print "Listening for client connections "
Set cs = cselesrv.Clients
while true
if (cs.count > 0) Then
set conn = cs.Element(0)
print ("First client address: "&conn.Address &" Port: " &conn.port)
’Disconnect
cs.RemoveElement(0)
End if
Wend
End Sub
Determines whether or not any more client connection objects exist in the collection.
object.HasMoreElements()
None.
Boolean. Returns TRUE if the collection contains more client connection objects; otherwise, FALSE.
This example determines whether or not more client connection objects exist in the collection.
’Usage: Run this sample, make client connections
’Display client information
Sub srvskt_conns_reset
set csrstsrv=CreateObject("UCX:NWSrvSkt")
csrstsrv.Port = 8080
csrstsrv.Protocol = TCP
csrstsrv.Listen = True
’Wait in infinite loop for client connections
Print "Listening for client connections "
Set cs = csrstsrv.Clients
while true
if (cs.count > 0) Then
cs.reset
while (cs.hasmoreelements())
set conn = cs.Next()
print ("Address: "&conn.Address &" Port: " &conn.port)
Wend
End if
Wend
End Sub
Returns the next Connection object from the collection.
object.Next()
None.
Connection.
This example returns the next Connection object from the collection.
’Usage: Run this sample, make client connections
’Display client information
Sub srvskt_conns_reset
set csrstsrv=CreateObject("UCX:NWSrvSkt")
csrstsrv.Port = 8080
csrstsrv.Protocol = TCP
csrstsrv.Listen = True
’Wait in infinite loop for client connections
print "Listening for client connections "
Set cs = csrstsrv.Clients
while true
if (cs.count > 0) Then
cs.reset
while (cs.hasmoreelements())
set conn = cs.Next()
print ("Address: "&conn.Address &" Port: " &conn.port)
Wend
End if
Wend
End Sub
Removes the specified client connection(s).
object.RemoveElement(
Index As Variant,
[,Port As Long])
A long index or address of the client to remove.
Optional. The port number of the client connection to remove.
Boolean. Returns TRUE if the client connection is successfully removed; otherwise, FALSE.
If the Index parameter specifies the client address with no port number, all connections from that client address are removed.
This example removes the client connection with the address 193.97.92.100.
’Usage: Run this sample, make client connections
’Disconnect the client from Address "193.97.92.100"
Sub srvskt_conns_remove
set csrmvsrv=CreateObject("UCX:NWSrvSkt")
csrmvsrv.Port = 8080
csrmvsrv.Protocol = TCP
csrmvsrv.Listen = True
’Wait in infinite loop for client connections
Print "Listening for client connections "
while true
Wend
End Sub
Sub csrmvsrv_connect(conn)
print "New connection from"" &conn.Address
if (conn.Address = "IP:193.97.54.165") Then
set cs = csrmvsrv.Clients
if (cs.RemoveElement("IP:193.97.54.165")) Then
print "Removed a connection from 193.97.92.100"
end if
End If
End Sub
Resets the client connections on the server.
object.Reset()
None.
Void.
This example resets the client connections on the server.
’Usage: Run this sample, make client connections
’Display client information
Sub srvskt_conns_reset
set csrstsrv=CreateObject("UCX:NWSrvSkt")
csrstsrv.Port = 8080
csrstsrv.Protocol = TCP
csrstsrv.Listen = True
’Wait in infinite loop for client connections
Print "Listening for client connections "
Set cs = csrstsrv.Clients
while true
if (cs.count > 0) Then
cs.reset
while (cs.hasmoreelements())
set conn = cs.Next()
print ("Address: "&conn.Address &" Port: " &conn.port)
Wend
End if
Wend
End Sub