CONNECT(2)

NAME
connect - connects a socket

SYNOPSIS
#include <sys/socket.h>
int connect(int sd, const struct sockaddr * addr, socklen_t addr_len);

DESCRIPTION
connect() connects the socket sd to a socket listening at address addr.

RETURN VALUES
On success, this function returns 0. On error, -1 is returned and errno is set.

ERRORS

[EFAULT]
    The address pointed to by addr is not in a valid part of the process address space.

[EAFNOSUPPORT]
    The address family of the address pointed to by addr is not supported by this function.

[EINVAL]
    The address pointed to by addr is not valid.

[ENAMETOOLONG]
    The sun_path in struct sockaddr_un is too long.

[EACCES]
    The calling process doesn't have permission to perform the connect() operation.

[EISCONN]
    The socket is already connected.

[EALREADY]
    The socket is already in the process of connecting.

[ECONNREFUSED]
    The connection was refused.

SEE ALSO
socket(2), accept(2)