]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxSocket::IPAddress() (patch 694119)
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 9 Jul 2003 23:15:00 +0000 (23:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 9 Jul 2003 23:15:00 +0000 (23:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21828 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
docs/latex/wx/ipvaddr.tex
include/wx/sckaddr.h
src/common/sckaddr.cpp

index 4f37b4e8e9c5c14231e703c85737c41f3dfc21a5..db48d4e0e1b3bb8ff6ef273c27635fba33f413f8 100644 (file)
@@ -57,6 +57,7 @@ All:
   and Mac) which contain some tests that were in setup.h
 - added event sink argument to wxEvtHandler::Connect()
 - added support for POST method and alt ports to wxHTTP (Roger Chickering)
+- added wxSocket::IPAddress() (Chris Mellon)
 
 wxBase:
 
index b561a33bb6c4e2370c7b5398bbd523d2543e9210..d78ac3ffb4be2f9991a34057f9dd9c42298272af 100644 (file)
@@ -42,6 +42,16 @@ Returns true on success, false if something goes wrong
 
 Returns the hostname which matches the IP address.
 
+%
+% IPAddress
+%
+
+\membersection{wxIPV4address::IPAddress}
+
+\func{wxString}{IPAddress}{\void}
+
+Returns a wxString containing the IP address in dot quad (127.0.0.1) format.
+
 %
 % Service
 %
index e1c980f61961d1bfbd06558768881a0b4e0b853a..adb67509b2b3f6fe30323f35879ed691a0ed19d2 100644 (file)
@@ -69,6 +69,7 @@ public:
   wxString Hostname();
   wxString OrigHostname() { return m_origHostname; }
   unsigned short Service();
+  wxString IPAddress() const;
 
   virtual int Type() { return wxSockAddress::IPV4; }
   virtual wxSockAddress *Clone() const;
index 66d12c2bd1da272f46e300bcdecdc5b4bd1d1fa6..80658f3314e7e3d29f4b9fb791dc08129cc169db 100644 (file)
@@ -181,6 +181,18 @@ wxSockAddress *wxIPV4address::Clone() const
     return addr;
 }
 
+wxString wxIPV4address::IPAddress() const
+{      
+       unsigned long raw =  GAddress_INET_GetHostAddress(m_address);
+       return wxString::Format(
+               _T("%u.%u.%u.%u"),
+               (unsigned char)(raw & 0xff),
+               (unsigned char)((raw>>8) & 0xff),
+               (unsigned char)((raw>>16) & 0xff),
+               (unsigned char)((raw>>24) & 0xff)
+               );
+}
+
 #if 0
 // ---------------------------------------------------------------------------
 // wxIPV6address