]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/sckaddr.cpp
Added (untested) support for sub-locales.
[wxWidgets.git] / src / common / sckaddr.cpp
index 801921e8aaecdb2f120b8ebc3112a7374a858bad..e83aa78b2fb114c624ea98c2258f3cf10278b3c2 100644 (file)
 #endif // __WINDOWS__
 
 #if defined(__UNIX__)
 #endif // __WINDOWS__
 
 #if defined(__UNIX__)
-
 #ifdef VMS
 #include <socket.h>
 #include <in.h>
 #else
 #ifdef VMS
 #include <socket.h>
 #include <in.h>
 #else
-#if defined(__FreeBSD__) || defined (__NetBSD__)
-#include <sys/types.h>
-#endif
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -60,8 +56,9 @@
 #include <netdb.h>
 
 #ifdef __SUN__
 #include <netdb.h>
 
 #ifdef __SUN__
-extern "C" {
-   int gethostname(char *name, int namelen);
+extern "C"
+{
+   struct hostent *gethostbyname(const char *name); 
 };
 #endif
 
 };
 #endif
 
@@ -83,8 +80,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress)
 #endif
 
 wxIPV4address::wxIPV4address()
 #endif
 
 wxIPV4address::wxIPV4address()
-  m_addr = new sockaddr_in;
 {
 {
+  m_addr = new sockaddr_in;
   Clear();
 }
 
   Clear();
 }
 
@@ -198,7 +195,11 @@ wxString wxIPV4address::Hostname()
 
   h_ent = gethostbyaddr((char *)&(m_addr->sin_addr), sizeof(m_addr->sin_addr),
                        GetFamily());
 
   h_ent = gethostbyaddr((char *)&(m_addr->sin_addr), sizeof(m_addr->sin_addr),
                        GetFamily());
-  return wxString(h_ent->h_name);
+                       
+  if (!h_ent)
+     return wxString("");
+  else
+     return wxString(h_ent->h_name);
 }
 
 unsigned short wxIPV4address::Service()
 }
 
 unsigned short wxIPV4address::Service()