Ticket #373: net-tcpserver.cc.patch
File net-tcpserver.cc.patch, 728 bytes (added by , 16 years ago) |
---|
-
net/tcpserver.cc
167 167 } 168 168 169 169 struct sockaddr_in addr; 170 addr.sin_family = AF_INET;171 170 addr.sin_port = htons(port); 172 171 if (host.empty()) { 172 addr.sin_family = AF_INET; 173 173 addr.sin_addr.s_addr = INADDR_ANY; 174 174 } else { 175 175 // FIXME: timeout on gethostbyname() ? … … 191 191 ); 192 192 } 193 193 194 memcpy(&addr.sin_addr, hostent->h_addr, sizeof(addr.sin_addr)); 194 addr.sin_family = hostent->h_addrtype; 195 memset(&addr.sin_addr, 0, sizeof(addr.sin_addr)); 196 memcpy(&addr.sin_addr, hostent->h_addr, hostent->h_length); 195 197 } 196 198 197 199 retval = bind(socketfd,