--- libelwix/src/net.c 2013/08/12 02:10:44 1.8 +++ libelwix/src/net.c 2014/02/10 22:50:44 1.10 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: net.c,v 1.8 2013/08/12 02:10:44 misho Exp $ +* $Id: net.c,v 1.10 2014/02/10 22:50:44 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 +Copyright 2004 - 2014 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -242,10 +242,7 @@ e_gethostbyname(const char *psHost, u_short port, sock if (*psHost != '/') { /* resolver */ - if (!addr->sa.sa_family) - host = gethostbyname(psHost); - else - host = gethostbyname2(psHost, addr->sa.sa_family); + host = gethostbyname2(psHost, !strchr(psHost, ':') ? AF_INET : AF_INET6); if (!host) { elwix_SetErr(EINVAL, "Resolver #%d - %s", h_errno, hstrerror(h_errno)); return NULL;