Index: linc2/src/linc-protocols.c
===================================================================
--- linc2/src/linc-protocols.c	(revision 2037)
+++ linc2/src/linc-protocols.c	(working copy)
@@ -30,7 +30,11 @@
 #undef LOCAL_DEBUG
 
 static char *link_tmpdir = NULL;
+#ifdef G_OS_WIN32
+static LinkNetIdType use_local_host = LINK_NET_ID_IS_IPADDR;
+#else
 static LinkNetIdType use_local_host = LINK_NET_ID_IS_FQDN;
+#endif
 static const char *fixed_host_net_id = NULL;
 
 /*
@@ -146,8 +150,13 @@
 	  char *buf, 
 	  size_t len)
 {
-	if (LINK_NET_ID_IS_LOCAL == which)
+	if (LINK_NET_ID_IS_LOCAL == which) {
+#ifndef G_OS_WIN32
 		return strncpy(buf, "localhost", len);
+#else
+		return strncpy(buf, "127.0.0.1", len);
+#endif
+	}
 
 	if ((LINK_NET_ID_IS_IPADDR == which)
 	    || (LINK_NET_ID_IS_CUSTOM == which)) {
@@ -851,29 +865,15 @@
 
 	g_assert (proto && saddr && saddr->sa_family == AF_INET);
 
-	if (sa_in->sin_addr.s_addr != INADDR_ANY) {
+#ifdef G_OS_WIN32
+	hname = inet_ntoa(sa_in->sin_addr);
+#else
+	if (ntohl (sa_in->sin_addr.s_addr) != INADDR_ANY) {
 		host = gethostbyaddr ((char *)&sa_in->sin_addr, 
                                       sizeof (struct in_addr), AF_INET);
 		if (!host)
 			return FALSE;
 		hname = host->h_name;
-	}
-#ifdef G_OS_WIN32
-	/* Make sure looking up that name works */
-	if (strcmp (hname, "localhost") == 0)
-		hname = "127.0.0.1"; /* Don't take any risk */
-	else {
-		char *hname_copy = g_strdup (hname);
-		host = gethostbyname (hname_copy);
-		
-		g_free (hname_copy);
-		if (host == NULL) {
-			/* Nope, use IP address then */
-			hname = inet_ntoa (sa_in->sin_addr);
-		} else {
-			hname = host->h_name;
-		}
-	}
 #endif
 	return link_protocol_get_sockinfo_ipv46 (hname, sa_in->sin_port, 
 						 hostname, portnum);
