Forum Discussion

Photo_G_84660's avatar
Photo_G_84660
Icon for Nimbostratus rankNimbostratus
Dec 28, 2006

CommonIPPortDefinition example

Hi,

 

 

Does anyone have a Visual Basic .NET example of using Pool.CommonIPPortDefinition() to extract the address and port of pool members into variables? I have been reviewing the C examples on the site, but I really need to see it in VB, if possible.

 

 

Thanks in advance,

 

Scott H.
  • Ok, I've hammered together this VB code, which seems to do the job. I'm not sure it's as elegant as it can be (so I'm open to suggestions), but if you feed it a pool name, it will grab the members and stick them in a ListBox.

     

     

    Take care,

     

    Scott H.

     

     

    
        Public Sub populateNodeList(ByVal pool As String())
            If lbxNode.Items.Count = 0 Then
                Dim node = New VirtualCurConnCounter.Pool.CommonIPPortDefinition()
                Dim member_list() = V9Pool.get_member(pool)
                node = member_list
                Dim i As Integer
                For i = 0 To UBound(node(0))
                    Dim addr = (node(0)(i).address.ToString)
                    Dim port = (node(0)(i).port.ToString)
                    lbxNode.Items.Add(addr + ":" + port)
                Next i
            Else
                lbxNode.Items.Clear()
                Dim index As Integer = lbxPool.SelectedIndex
                Dim pool_name As String = lbxPool.Items(index).ToString
                populateNodeList(New String() {pool_name})
            End If
        End Sub