Use INADDR_NONE instead of -1 to check inet_addr() result --- cbtcommon/tcpsocket.c.1 2013-04-14 13:21:14.848464155 +0400 +++ cbtcommon/tcpsocket.c 2013-04-14 13:23:23.015136709 +0400 @@ -198,7 +198,7 @@ memcpy(dest, &ip.s_addr, sizeof(ip.s_addr)); } #else - if ( (*dest = inet_addr(addr_str)) != -1) + if ( (*dest = inet_addr(addr_str)) != INADDR_NONE) { /* nothing */ }