--- libaitrpc/src/cli.c 2015/06/28 21:40:45 1.25.2.1 +++ libaitrpc/src/cli.c 2015/06/28 21:52:26 1.25.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cli.c,v 1.25.2.1 2015/06/28 21:40:45 misho Exp $ +* $Id: cli.c,v 1.25.2.2 2015/06/28 21:52:26 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -223,6 +223,16 @@ rpc_cli_openClient(u_char InstID, int netBuf, const ch LOGERR; goto err; } + if (cli->cli_id == SOCK_DGRAM) { + sockaddr_t sa2; + + if (!e_gethostbyname(csHost, 0, &sa2)) + goto err; + if (bind(cli->cli_sock, &sa2.sa, sa2.sa.sa_len) == -1) { + LOGERR; + goto err; + } + } fcntl(cli->cli_sock, F_SETFL, fcntl(cli->cli_sock, F_GETFL) | O_NONBLOCK); return cli;