--- libaitmqtt/src/cliside.c 2012/06/28 11:06:17 1.3 +++ libaitmqtt/src/cliside.c 2016/09/14 15:52:36 1.3.12.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cliside.c,v 1.3 2012/06/28 11:06:17 misho Exp $ +* $Id: cliside.c,v 1.3.12.1 2016/09/14 15:52:36 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 +Copyright 2004 - 2016 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -75,7 +75,13 @@ mqtt_cli_Open(struct sockaddr *addr, u_short timeout) free(cli); return NULL; } +#ifndef __linux__ if (connect(cli->sock, addr, addr->sa_len) == -1) { +#else + if (connect(cli->sock, addr, addr->sa_family == AF_INET6 ? + sizeof(struct sockaddr_in6) : + sizeof(struct sockaddr_in)) == -1) { +#endif LOGERR; close(cli->sock); free(cli);