All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
advertising materials, and other materials related to such
distribution and use acknowledge that the software was developed
by the University of California, Berkeley. The name of the
University may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@(#)connect.2 6.7 (Berkeley) 02/14/89
#include <sys/types.h> #include <sys/socket.h>connect(s, name, namelen) int s; struct sockaddr *name; int namelen;
20 [EBADF] S is not a valid descriptor.
20 [ENOTSOCK] S is a descriptor for a file, not a socket.
20 [EADDRNOTAVAIL] The specified address is not available on this machine.
20 [EAFNOSUPPORT] Addresses in the specified address family cannot be used with this socket.
20 [EISCONN] The socket is already connected.
20 [ETIMEDOUT] Connection establishment timed out without establishing a connection.
20 [ECONNREFUSED] The attempt to connect was forcefully rejected.
20 [ENETUNREACH] The network isn't reachable from this host.
20 [EADDRINUSE] The address is already in use.
20 [EFAULT] The name parameter specifies an area outside the process address space.
20 [EINPROGRESS] The socket is non-blocking and the connection cannot be completed immediately. It is possible to select (2) for completion by selecting the socket for writing.
20 [EALREADY] The socket is non-blocking and a previous connection attempt has not yet been completed.
The following errors are specific to connecting names in the UNIX domain. These errors may not apply in future versions of the UNIX IPC domain.
15 [ENOTDIR] A component of the path prefix is not a directory.
15 [EINVAL] The pathname contains a character with the high-order bit set.
15 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
15 [ENOENT] The named socket does not exist.
15 [EACCES] Search permission is denied for a component of the path prefix.
15 [EACCES] Write access to the named socket is denied.
15 [ELOOP] Too many symbolic links were encountered in translating the pathname.