Annotation of 43BSDTahoe/man/man4/tcp.4, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1983 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"    @(#)tcp.4p      6.2 (Berkeley) 5/16/86
                      6: .\"
                      7: .TH TCP 4P "May 16, 1986"
                      8: .UC 5
                      9: .SH NAME
                     10: tcp \- Internet Transmission Control Protocol
                     11: .SH SYNOPSIS
                     12: .B #include <sys/socket.h>
                     13: .br
                     14: .B #include <netinet/in.h>
                     15: .PP
                     16: .B s = socket(AF_INET, SOCK_STREAM, 0);
                     17: .SH DESCRIPTION
                     18: The TCP protocol provides reliable, flow-controlled, two-way
                     19: transmission of data.  It is a byte-stream protocol used to
                     20: support the SOCK_STREAM abstraction.  TCP uses the standard
                     21: Internet address format and, in addition, provides a per-host
                     22: collection of \*(lqport addresses\*(rq.  Thus, each address is composed
                     23: of an Internet address specifying the host and network, with
                     24: a specific TCP port on the host identifying the peer entity.
                     25: .PP
                     26: Sockets utilizing the tcp protocol are either \*(lqactive\*(rq or
                     27: \*(lqpassive\*(rq.  Active sockets initiate connections to passive
                     28: sockets.  By default TCP sockets are created active; to create a
                     29: passive socket the
                     30: .IR listen (2)
                     31: system call must be used
                     32: after binding the socket with the
                     33: .IR bind (2)
                     34: system call.  Only
                     35: passive sockets may use the 
                     36: .IR accept (2)
                     37: call to accept incoming connections.  Only active sockets may
                     38: use the
                     39: .IR connect (2)
                     40: call to initiate connections.
                     41: .PP
                     42: Passive sockets may \*(lqunderspecify\*(rq their location to match
                     43: incoming connection requests from multiple networks.  This
                     44: technique, termed \*(lqwildcard addressing\*(rq, allows a single
                     45: server to provide service to clients on multiple networks.
                     46: To create a socket which listens on all networks, the Internet
                     47: address INADDR_ANY
                     48: must be bound.  The TCP port may still be specified
                     49: at this time; if the port is not specified the system will assign one.
                     50: Once a connection has been established the socket's address is
                     51: fixed by the peer entity's location.   The address assigned the
                     52: socket is the address associated with the network interface
                     53: through which packets are being transmitted and received.  Normally
                     54: this address corresponds to the peer entity's network.
                     55: .PP
                     56: TCP supports one socket option which is set with
                     57: .IR setsockopt (2)
                     58: and tested with
                     59: .IR getsockopt (2).
                     60: Under most circumstances, TCP sends data when it is presented;
                     61: when outstanding data has not yet been acknowledged, it gathers
                     62: small amounts of output to be sent in a single packet once
                     63: an acknowledgement is received.
                     64: For a small number of clients, such as window systems
                     65: that send a stream of mouse events which receive no replies,
                     66: this packetization may cause significant delays.
                     67: Therefore, TCP provides a boolean option, TCP_NODELAY (from
                     68: .IR <netinet/tcp.h> ,
                     69: to defeat this algorithm.
                     70: The option level for the
                     71: .I setsockopt
                     72: call is the protocol number for TCP,
                     73: available from
                     74: .IR getprotobyname (3N).
                     75: .PP
                     76: Options at the IP transport level may be used with TCP; see
                     77: .IR ip (4P).
                     78: Incoming connection requests that are source-routed are noted,
                     79: and the reverse source route is used in responding.
                     80: .SH DIAGNOSTICS
                     81: A socket operation may fail with one of the following errors returned:
                     82: .TP 20
                     83: [EISCONN]
                     84: when trying to establish a connection on a socket which
                     85: already has one;
                     86: .TP 20
                     87: [ENOBUFS]
                     88: when the system runs out of memory for
                     89: an internal data structure;
                     90: .TP 20
                     91: [ETIMEDOUT]
                     92: when a connection was dropped
                     93: due to excessive retransmissions;
                     94: .TP 20
                     95: [ECONNRESET]
                     96: when the remote peer
                     97: forces the connection to be closed;
                     98: .TP 20
                     99: [ECONNREFUSED]
                    100: when the remote
                    101: peer actively refuses connection establishment (usually because
                    102: no process is listening to the port);
                    103: .TP 20
                    104: [EADDRINUSE]
                    105: when an attempt
                    106: is made to create a socket with a port which has already been
                    107: allocated;
                    108: .TP 20
                    109: [EADDRNOTAVAIL]
                    110: when an attempt is made to create a 
                    111: socket with a network address for which no network interface
                    112: exists.
                    113: .SH SEE ALSO
                    114: getsockopt(2), socket(2), intro(4N), inet(4F), ip(4P)

unix.superglobalmegacorp.com

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