JH/26 Port service names are now accepted for tls_on_connect_ports, to
align with daemon_smtp_ports. Bug 72.
+TF/03 Fix udpsend. The ip_connectedsocket() function's socket type
+ support and error reporting did not work properly.
+
Exim version 4.82
-----------------
}
+
+/*************************************************
+* Create connected socket to remote host *
+*************************************************/
+
/* Create a socket and connect to host (name or number, ipv6 ok)
at one of port-range.
+
Arguments:
type SOCK_DGRAM or SOCK_STREAM
af AF_INET6 or AF_INET for the socket type
for (h = &shost; h != NULL; h = h->next)
{
fd = (Ustrchr(h->address, ':') != 0)
- ? (fd6 < 0) ? (fd6 = ip_socket(SOCK_STREAM, af = AF_INET6)) : fd6
- : (fd4 < 0) ? (fd4 = ip_socket(SOCK_STREAM, af = AF_INET )) : fd4;
+ ? (fd6 < 0) ? (fd6 = ip_socket(type, af = AF_INET6)) : fd6
+ : (fd4 < 0) ? (fd4 = ip_socket(type, af = AF_INET )) : fd4;
if (fd < 0)
{
}
}
-*errstr = string_sprintf("failed to connect to "
- "%s: couldn't connect to any host", hostname, strerror(errno));
+*errstr = string_sprintf("failed to connect to %s: "
+ "couldn't connect to any host: %s", hostname, strerror(errno));
bad:
close(fd4); close(fd6); return -1;