+IPAddress::IPAddress( const IPAddress& other ) :
+ addr(NULL)
+{
+ if (other.addr) {
+ addr = (struct sockaddr_in*) malloc(sizeof(struct sockaddr_in));
+ memcpy(addr, other.addr, sizeof(struct sockaddr_in));
+ }
+}
+
+const IPAddress& IPAddress::operator=(const IPAddress& other)
+{
+ if (addr) {
+ free(addr);
+ addr = NULL;
+ }
+
+ if (other.addr) {
+ addr = (struct sockaddr_in*) malloc(sizeof(struct sockaddr_in));
+ memcpy(addr, other.addr, sizeof(struct sockaddr_in));
+ }
+
+ return *this;
+}
+