diff --git a/std/socket.d b/std/socket.d index 7060b7a5cfe..fa45f3d9456 100644 --- a/std/socket.d +++ b/std/socket.d @@ -1662,6 +1662,23 @@ public: } } + /** + * Compares with another InternetAddress of same type for equality + * Returns: true if the InternetAddresses share the same address and + * port number. + * Examples: + * -------------- + * InternetAddress addr1,addr2; + * if (addr1 == addr2) { } + * -------------- + */ + override bool opEquals(Object o) const + { + auto other = cast(InternetAddress)o; + return other && this.sin.sin_addr.s_addr == other.sin.sin_addr.s_addr && + this.sin.sin_port == other.sin.sin_port; + } + /** * Parse an IPv4 address string in the dotted-decimal form $(I a.b.c.d) * and return the number.