Query: tcp
OS: ultrix
Section: 4p
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
tcp(4p) tcp(4p) Name tcp - Internet Transmission Control Protocol Syntax #include <sys/socket.h> #include <netinet/in.h> s = socket(AF_INET, SOCK_STREAM, 0); Description The TCP protocol provides reliable, flow-controlled, two-way transmission of data. It is a byte-stream protocol used to support the SOCK_STREAM abstraction. TCP uses the standard Internet address format and, in addition, provides a per-host collection of ``port addresses''. Thus, each address is composed of an Internet address specifying the host and network, with a specific TCP port on the host identifying the peer entity. Sockets utilizing the TCP protocol are either ``active'' or ``passive''. Active sockets initiate connections to passive sockets. By default TCP sockets are created active; to create a passive socket the system call must be used after binding the socket with the system call. Only passive sockets can use the call to accept incoming connections. Only active sockets can use the call to initiate connections. Passive sockets can ``underspecify'' their location to match incoming connection requests from multiple networks. This technique, termed ``wildcard addressing'', allows a single server to provide service to clients on multiple networks. To create a socket that listens on all networks, the Internet address INADDR_ANY must be bound. The TCP port can still be specified at this time. If the port is not specified, the system will assign one. Once a connection has been established, the socket's address is fixed by the peer entity's location. The address assigned the socket is the address associated with the network interface through which packets are being transmitted and received. Normally, this address corresponds to the peer entity's network. TCP supports one socket option that is set with and tested with Under most circumstances, TCP sends data when it is presented; when out- standing data has not yet been acknowledged, it gathers small amounts of output to be sent in a single packet, once an acknowledgement is received. For a small number of clients, such as window systems that send a stream of mouse events that receive no replies, this packeti- zation may cause significant delays. Therefore, TCP provides a Boolean option, TCP_NODELAY (from to defeat this algorithm. The option level for the call is the protocol number for TCP, available from Diagnostics A socket operation may fail with one of the following errors returned: [EISCONN] Try to establish a connection on a socket which already has one. [ENOBUFS] The system runs out of memory for an internal data structure. [ETIMEDOUT] A connection was dropped due to excessive retransmissions. [ECONNRESET] The remote peer forces the connection to be closed. [ECONNREFUSED] The remote peer actively refuses connection establishment (usually because no process is listening to the port). [EADDRINUSE] An attempt is made to create a socket with a port that has already been allocated. [EADDRNOTAVAIL] An attempt is made to create a socket with a network address for which no network interface exists. See Also getsockopt(2), socket(2), inet(4f), intro(4n), ip(4p) tcp(4p)
Related Man Pages |
---|
spp(4p) - bsd |
udp(4) - mojave |
tcp(4) - osx |
udp(4) - opendarwin |
tcp(4p) - ultrix |
Similar Topics in the Unix Linux Community |
---|
advanced socket programming |
Confusion about TCP/IP socket programming |
How to get active connections in Unix |
Using socket to test a TCP port |
Issues with select system call |