diff --git a/src/xpdev/sockwrap.c b/src/xpdev/sockwrap.c
index f1eedf23f7d118d6004a1f50989945e7fa98f2d6..84557df73ad688810cb770ba87c1e888d1c60250 100644
--- a/src/xpdev/sockwrap.c
+++ b/src/xpdev/sockwrap.c
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * CopyrightRob Swindell - http://www.synchro.net/copyright.html			*
+ * Copyright Rob Swindell - http://www.synchro.net/copyright.html			*
  *																			*
  * This library is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU Lesser General Public License		*
@@ -481,3 +481,18 @@ void DLLCALL inet_setaddrport(union xp_sockaddr *addr, uint16_t port)
 			break;
 	}
 }
+
+/* Return TRUE if the 2 addresses are the same host (type and address) */
+BOOL DLLCALL inet_addrmatch(union xp_sockaddr* addr1, union xp_sockaddr* addr2)
+{
+	if(addr1->addr.sa_family != addr2->addr.sa_family)
+		return FALSE;
+
+	switch(addr1->addr.sa_family) {
+		case AF_INET:
+			return memcmp(&addr1->in.sin_addr, &addr2->in.sin_addr, sizeof(addr1->in.sin_addr)) == 0;
+		case AF_INET6:
+			return memcmp(&addr1->in6.sin6_addr, &addr2->in6.sin6_addr, sizeof(addr1->in6.sin6_addr)) == 0;
+	}
+	return FALSE;
+}
diff --git a/src/xpdev/sockwrap.h b/src/xpdev/sockwrap.h
index f3d67afde6de655c68b54bfa090fb19981d3719c..33163525b30650dace840fd5989e1ab619bdc026 100644
--- a/src/xpdev/sockwrap.h
+++ b/src/xpdev/sockwrap.h
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright Rob Swindell - http://www.synchro.net/copyright.html			*
  *																			*
  * This library is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU Lesser General Public License		*
@@ -233,6 +233,7 @@ DLLEXPORT union xp_sockaddr* DLLCALL inet_ptoaddr(char *addr_str, union xp_socka
 DLLEXPORT const char* DLLCALL inet_addrtop(union xp_sockaddr *addr, char *dest, size_t size);
 DLLEXPORT uint16_t DLLCALL inet_addrport(union xp_sockaddr *addr);
 DLLEXPORT void DLLCALL inet_setaddrport(union xp_sockaddr *addr, uint16_t port);
+DLLEXPORT BOOL DLLCALL inet_addrmatch(union xp_sockaddr* addr1, union xp_sockaddr* addr2);
 
 #ifdef __cplusplus
 }