Annotation of 43BSDReno/lib/libc/sys/connect.2, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1983 The Regents of the University of California.
                      2: .\" All rights reserved.
                      3: .\"
                      4: .\" Redistribution and use in source and binary forms are permitted provided
                      5: .\" that: (1) source distributions retain this entire copyright notice and
                      6: .\" comment, and (2) distributions including binaries display the following
                      7: .\" acknowledgement:  ``This product includes software developed by the
                      8: .\" University of California, Berkeley and its contributors'' in the
                      9: .\" documentation or other materials provided with the distribution and in
                     10: .\" all advertising materials mentioning features or use of this software.
                     11: .\" Neither the name of the University nor the names of its contributors may
                     12: .\" be used to endorse or promote products derived from this software without
                     13: .\" specific prior written permission.
                     14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     17: .\"
                     18: .\"    @(#)connect.2   6.8 (Berkeley) 6/23/90
                     19: .\"
                     20: .TH CONNECT 2 "June 23, 1990"
                     21: .UC 5
                     22: .SH NAME
                     23: connect \- initiate a connection on a socket
                     24: .SH SYNOPSIS
                     25: .nf
                     26: .ft B
                     27: #include <sys/types.h>
                     28: #include <sys/socket.h>
                     29: .PP
                     30: .ft B
                     31: connect(s, name, namelen)
                     32: int s;
                     33: struct sockaddr *name;
                     34: int namelen;
                     35: .fi
                     36: .SH DESCRIPTION
                     37: The parameter
                     38: .I s
                     39: is a socket.
                     40: If it is of type SOCK_DGRAM,
                     41: then this call specifies the peer with which the socket is to be associated;
                     42: this address is that to which datagrams are to be sent,
                     43: and the only address from which datagrams are to be received.
                     44: If the socket is of type SOCK_STREAM,
                     45: then this call attempts to make a connection to
                     46: another socket.
                     47: The other socket is specified by
                     48: .I name,
                     49: which is an address in the communications space of the socket.
                     50: Each communications space interprets the
                     51: .I name
                     52: parameter in its own way.
                     53: Generally, stream sockets may successfully
                     54: .I connect
                     55: only once; datagram sockets may use
                     56: .I connect
                     57: multiple times to change their association.
                     58: Datagram sockets may dissolve the association
                     59: by connecting to an invalid address, such as a null address.
                     60: .SH "RETURN VALUE
                     61: If the connection or binding succeeds, then 0 is returned.
                     62: Otherwise a \-1 is returned, and a more specific error
                     63: code is stored in \fIerrno\fP.
                     64: .SH "ERRORS
                     65: The call fails if:
                     66: .TP 20
                     67: [EBADF]
                     68: .I S
                     69: is not a valid descriptor.
                     70: .TP 20
                     71: [ENOTSOCK]
                     72: .I S
                     73: is a descriptor for a file, not a socket.
                     74: .TP 20
                     75: [EADDRNOTAVAIL]
                     76: The specified address is not available on this machine.
                     77: .TP 20
                     78: [EAFNOSUPPORT]
                     79: Addresses in the specified address family cannot be used with this socket.
                     80: .TP 20
                     81: [EISCONN]
                     82: The socket is already connected.
                     83: .TP 20
                     84: [ETIMEDOUT]
                     85: Connection establishment timed out without establishing a connection.
                     86: .TP 20
                     87: [ECONNREFUSED]
                     88: The attempt to connect was forcefully rejected.
                     89: .TP 20
                     90: [ENETUNREACH]
                     91: The network isn't reachable from this host.
                     92: .TP 20
                     93: [EADDRINUSE]
                     94: The address is already in use.
                     95: .TP 20
                     96: [EFAULT]
                     97: The \fIname\fP parameter specifies an area outside
                     98: the process address space.
                     99: .TP 20
                    100: [EINPROGRESS]
                    101: The socket is non-blocking 
                    102: and the connection cannot
                    103: be completed immediately.
                    104: It is possible to
                    105: .IR select (2)
                    106: for completion by selecting the socket for writing.
                    107: .TP 20
                    108: [EALREADY]
                    109: The socket is non-blocking
                    110: and a previous connection attempt
                    111: has not yet been completed.
                    112: .PP
                    113: The following errors are specific to connecting names in the UNIX domain.
                    114: These errors may not apply in future versions of the UNIX IPC domain.
                    115: .TP 15
                    116: [ENOTDIR]
                    117: A component of the path prefix is not a directory.
                    118: .TP 15
                    119: [EINVAL]
                    120: The pathname contains a character with the high-order bit set.
                    121: .TP 15
                    122: [ENAMETOOLONG]
                    123: A component of a pathname exceeded 255 characters,
                    124: or an entire path name exceeded 1023 characters.
                    125: .TP 15
                    126: [ENOENT]
                    127: The named socket does not exist.
                    128: .TP 15
                    129: [EACCES]
                    130: Search permission is denied for a component of the path prefix.
                    131: .TP 15
                    132: [EACCES]
                    133: Write access to the named socket is denied.
                    134: .TP 15
                    135: [ELOOP]
                    136: Too many symbolic links were encountered in translating the pathname.
                    137: .SH SEE ALSO
                    138: accept(2), select(2), socket(2), getsockname(2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.