How do I display the IP addresses that have been retrieved with WLRegNetInstancesGetClientsIp?

<< Click to Display Table of Contents >>

Navigation:  WinLicense > FAQ > Registration > Network Instances >

How do I display the IP addresses that have been retrieved with WLRegNetInstancesGetClientsIp?

The following code example might help you to know how to display the IP addresses from the function WLRegNetInstancesGetClientsIp.

 

  const int MAX_IPS = 100;

   WL_IP_ADDRESS buffer_ips[MAX_IPS];

 

  int number_ips = WLRegNetInstancesGetClientsIp(buffer_ips, MAX_IPS);

  TCHAR strOutput[MAX_IPS * 40] = { 0 };

 

  for (int i = 0; i < number_ips; i++)

   {

      TCHAR ip[256];

 

      if (buffer_ips[i].is_v6)

       {

          _stprintf_s(ip, 256, _T("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x"),

              buffer_ips[i].i16,

              buffer_ips[i].i15,

              buffer_ips[i].i14,

              buffer_ips[i].i13,

              buffer_ips[i].i12,

              buffer_ips[i].i11,

              buffer_ips[i].i10,

              buffer_ips[i].i9,

              buffer_ips[i].i8,

              buffer_ips[i].i7,

              buffer_ips[i].i6,

              buffer_ips[i].i5,

              buffer_ips[i].i4,

              buffer_ips[i].i3,

              buffer_ips[i].i2,

              buffer_ips[i].i1);

 

          lstrcat(strOutput, ip);

       }

      else

       {

          _stprintf_s(ip, 256, _T("%d.%d.%d.%d"),

              buffer_ips[i].i4,

              buffer_ips[i].i3,

              buffer_ips[i].i2,

              buffer_ips[i].i1);

 

          lstrcat(strOutput, ip);

       }

      lstrcat(strOutput, _T("\r\n"));

   }

  MessageBox(hDlg, strOutput, _T("Client IPs"), 0);