Forum Discussion

OTS02's avatar
OTS02
Icon for Cirrus rankCirrus
Feb 02, 2009

show current connections with VB

Could someone provide me with a example of how to show current connections for a particular pool member in VB?

 

 

Thanks

13 Replies

  • OK, I see that "new" should not be capitalized, but am still having trouble getting this thing off the ground.

     

  • You need to declare your MemberStatisticEntry as a 2-d array per the API definition. Also, the first parameter needs to be an array of pool names. This code should work for you:

     

    public UInt64 build64(iControl.CommonULong64 ul64)    
     {    
     return (UInt64)((UInt64)(ul64.high << 32) | (UInt64)ul64.low);    
     }    
     public void getPoolMemberStatistics(string pool, string memberaddr, int memberport)    
     {    
       string [] pool_names = new string[] { pool };    
       iControl.CommonIPPortDefinition[][] members = new iControl.CommonIPPortDefinition[1][];    
       members[0 ] = new iControl.CommonIPPortDefinition[1];    
       members[0][0] = new iControl.CommonIPPortDefinition();    
       members[0][0].address = memberaddr;    
       members[0][0].port = memberport;    
       iControl.LocalLBPoolMemberMemberStatistics [] stats =     
         m_interfaces.LocalLBPoolMember.get_statistics(pool_names, members);    
       //Loop over the pools    
       for (int i=0; i   {     
         Console.WriteLine("Pool: {0}", pool_names[ i ]);    
         // Loop over the pool members for each pool    
         for (int j = 0; j < stats[ i ].statistics.Length; j++)    
         {    
           Console.WriteLine("  Member -> {0}:{1}",    
           stats[ i ].statistics[ j ].member.address,    
           stats[ i ].statistics[ j ].member.port.ToString());    
           for(int k=0; k < stats[ i ].statistics[ j ].statistics.Length; k++)    
           {    
             Console.WriteLine("    {0} -> {1}",    
               stats[ i ].statistics[ j ].statistics[ k ].type.ToString(),    
               build64(stats[ i ].statistics[ j ].statistics[ k ].value).ToString());    
           }    
         }    
       }    
     }
  • Thank you so much Joe!

     

     

    BTW, I was viewing a similar post (example of a call to PoolMember.set_monitor_state). It would have been very helpful, exept that many of the bracket characters and thier contents were corrupted (in my browser anyway). If the corrupted characters were cleaned up, the post would be much more valuable to folks who are new to c.

     

     

    Cheers!