diff --git a/net/socket.h b/net/socket.h
index 62cc926d..489bf83d 100644
--- a/net/socket.h
+++ b/net/socket.h
@@ -46,6 +46,7 @@ namespace net {
     public:
         union {
             in6_addr addr = {};
+            // all data is in network byte order
             struct { uint16_t _1, _2, _3, _4, _5, _6; uint8_t a, b, c, d; };
         } __attribute__((packed));
         // For compatibility, the default constructor is still 0.0.0.0 (IPv4)
@@ -97,6 +98,8 @@ namespace net {
         bool undefined() const {
             return mem_equal(V4Any());
         }
+        void reset() { *this = IPAddr(); }
+        void clear() { reset(); }
         // Should ONLY be used for IPv4 address
         uint32_t to_nl() const {
             assert(is_ipv4());
@@ -169,7 +172,14 @@ namespace net {
             return !operator==(rhs);
         }
         bool undefined() const {
-            return addr.undefined();
+            return addr.undefined() && port == 0;
+        }
+        void reset() {
+            addr.reset();
+            port = 0;
+        }
+        void clear() {
+            reset();
         }
     };
 
diff --git a/net/test/test-ipv6.cpp b/net/test/test-ipv6.cpp
index acb6f093..becf6317 100644
--- a/net/test/test-ipv6.cpp
+++ b/net/test/test-ipv6.cpp
@@ -17,7 +17,7 @@ TEST(ipv6, endpoint) {
     c = photon::net::EndPoint("[::1]:8888");
     EXPECT_FALSE(c.undefined());
     c = photon::net::EndPoint("0.0.0.0:8888");
-    EXPECT_TRUE(c.undefined());
+    EXPECT_FALSE(c.undefined());
     EXPECT_EQ(8888, c.port);
     c = photon::net::EndPoint("::", 8888);
     EXPECT_TRUE(!c.undefined());