wxIPV4address::IPAddress problem

Mark Clarkson mark.clarkson at smorg.co.uk
Sun Nov 18 03:56:45 PST 2007


Hi,
I can't get wxIPV4address::IPAddress() to work properly on Windows.
With the following patch to the minimal sample on WinXP I get:

  ipaddress=73014444042.73014444043.73014444044.73014444034

under Linux it works as I expect:

  ipaddress=192.168.1.1

This happens with both wx2.8 and wx2.9 svn branches.
Win32 binary compiled with mingw under Linux (debian unstable).

Any ideas?

--- minimal.cpp 2007-11-17 23:15:10.000000000 +0000
+++ minimal.cpp.new 2007-11-17 23:08:33.000000000 +0000
@@ -17,6 +17,9 @@
// headers
//
----------------------------------------------------------------------------
  
+#include <stdio.h>
+#include <wx/socket.h>
+
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
  
@@ -185,13 +188,19 @@

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
+        wxIPV4address dsthost;
+        dsthost.Hostname( _("192.168.1.1" ) );
+        wxString ipaddress = dsthost.IPAddress();
+
     wxMessageBox(wxString::Format(
                     _T("Welcome to %s!\n")
                     _T("\n")
                     _T("This is the minimal wxWidgets sample\n")
-                    _T("running under %s."),
+                    _T("running under %s.")
+                    _T("\nipaddress=%s"),
                     wxVERSION_STRING,
-                    wxGetOsDescription().c_str()
+                    wxGetOsDescription().c_str(),
+                    ipaddress
                  ),
                  _T("About wxWidgets minimal sample"),
                  wxOK | wxICON_INFORMATION,






More information about the wx-users mailing list