Free cookie consent management tool by TermsFeed Policy Generator

Changeset 765


Ignore:
Timestamp:
11/15/08 20:19:52 (15 years ago)
Author:
gkronber
Message:

quick fix for #361 (19*19!) (GridServer doesn't work on Vista when IPv6 protocol is installed).
We should really find a better way to automatically determine an external IP address of a host.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Grid/ServerForm.cs

    r578 r765  
    4646
    4747      IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName());
    48       // windows XP returns the external ip on index 0 while windows vista returns the external ip on index 2 (presumably in the last entry, which normally is 2)
     48      // windows XP returns the external ip on index 0 while windows vista returns the external ip as one of the last entries
     49      // also if IPv6 protocol is installed we want to find an entry that is IPv4
    4950      int index = 0;
    5051      if (System.Environment.OSVersion.Version.Major >= 6) {
    51         index = addresses.Length - 1;
     52        for (index = addresses.Length - 1; index >= 0; index--)
     53          if (addresses[index].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
     54            break;
    5255      }
    5356      externalAddressTextBox.Text = "net.tcp://" + addresses[index] + ":8000/Grid/Service";
Note: See TracChangeset for help on using the changeset viewer.