Menu

Fix to IP addrees handling in Vista based os'

2008-09-23
2013-04-02
  • Mr. Kimmo P.

    Mr. Kimmo P. - 2008-09-23

    Vista based operating systems returns IPV6 addresses as the first address in the IPAddress list collection. I made new function to library (FTPConnection class)

            private IPAddress GetLocalAddressIPV4()
            {           
                IPAddress[] result = Dns.GetHostAddresses(System.Environment.MachineName);
                for (int i = 0; i < result.Length; i++) {
                    if (result[i].AddressFamily == AddressFamily.InterNetwork) return result[i];
                }
                return null; //this is error and means that no IPV4 address found
            }

     
    • Mr. Kimmo P.

      Mr. Kimmo P. - 2008-09-23

      Sorry about the typo in subject.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.