* directly after makesock(). The 'pre_conn_opt' structure is for internal use
* only and should not be visible elsewhere.
*
* directly after makesock(). The 'pre_conn_opt' structure is for internal use
* only and should not be visible elsewhere.
*
for (; ai; ai = ai->ai_next) {
int fd;
ret = socket(ai->ai_family, sock_type(l4type), l4type);
for (; ai; ai = ai->ai_next) {
int fd;
ret = socket(ai->ai_family, sock_type(l4type), l4type);
- if (connect(fd, ai->ai_addr, ai->ai_addrlen) == 0)
- return fd;
- close(fd);
- continue;
+ if (connect(fd, ai->ai_addr, ai->ai_addrlen) < 0) {
+ PARA_NOTICE_LOG("connect(): %s\n",
+ strerror(errno));
+ close(fd);
+ continue;
+ }
+ return fd;
*/
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) == -1) {
*/
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) == -1) {
*
* \param l4type The transport-layer type (\p IPPROTO_xxx).
* \param port The decimal port number to listen on.
*
* \param l4type The transport-layer type (\p IPPROTO_xxx).
* \param port The decimal port number to listen on.
*
* \return Positive integer (socket descriptor) on success, negative value
* otherwise.
*
* \sa \ref makesock(), ip(7), ipv6(7), bind(2), listen(2).
*/
*
* \return Positive integer (socket descriptor) on success, negative value
* otherwise.
*
* \sa \ref makesock(), ip(7), ipv6(7), bind(2), listen(2).
*/
- int ret, fd = makesock(l4type, 1, NULL, port, fo);
+ int ret, fd = makesock(l4type, 1, NULL, port, NULL);
* \return A static character string identifying hostname and port of the
* chosen side in numeric host:port format.
*
* \return A static character string identifying hostname and port of the
* chosen side in numeric host:port format.
*
- * \sa getsockname(2), getpeername(2), parse_url(), getnameinfo(3),
+ * \sa getsockname(2), getpeername(2), \ref parse_url(), getnameinfo(3),
* services(5), nsswitch.conf(5).
*/
char *remote_name(int fd)
* services(5), nsswitch.conf(5).
*/
char *remote_name(int fd)
* \return On success, this call returns the number of bytes sent. On errors,
* \p -E_SENDMSG is returned.
*
* \return On success, this call returns the number of bytes sent. On errors,
* \p -E_SENDMSG is returned.
*
- * \sa \ref recv_cred_buffer, sendmsg(2), socket(7), unix(7), okir's Black Hats
- * Manual.
+ * \sa \ref recv_cred_buffer, sendmsg(2), socket(7), unix(7).