Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tcp(7P) — GL2 W2.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

net(7P)

inet(7P)

TCP(7P)  —  Silicon Graphics

NAME

tcp − Internet Transmission Control Protocol

SYNOPSIS

#include <sys/socket.h>
#include <netinet/in.h>
struct sockproto proto = { PF_INET, IPPROTO_TCP };
socket(SOCK_STREAM, &proto, address, options);
struct sockaddr_in *address; int options;

DESCRIPTION

The TCP protocol provides reliable, flow-controlled, two-way data transmission.  It is a byte-stream protocol supporting SOCK_STREAM.  TCP uses the standard Internet address format and provides a per-host collection of “port addresses.” Thus, each address is an Internet address specifying the host and network, with a specific TCP port on the host identifying the peer entity. 

Sockets using 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 SO_ACCEPTCONN must be used.  Only passive sockets can use the accept(3N) call to accept incoming connections.  Only active sockets can use the connect(3N) call to initiate connections. 

Passive sockets may “underspecify” their location to match incoming connection requests from multiple networks (“wildcard addressing”).  Thus a single server can service clients on multiple networks.  To create a socket that can listen to all networks, the Internet address INADDR_ANY should be used. 

The TCP port may still be specified at this time; if not, the system assigns one.  Once a connection has been established, the socket’s address is fixed by the peer entity’s location.  The address associated with network interface where packets are being transmitted and received is assigned to the socket.  Normally this address corresponds to the peer entity’s network. 

OPTIONS

The TCP implementation supports one nonstandard feature:  “keep-alives.” Keep-alives check if a peer entity is still functional.  They are enabled by creating a socket with the SO_KEEPALIVE option.  They periodically poll the remote machine if the connection has been idle.  Keep-alive packets are transmitted on a connection that has been idle for longer than one minute.  If there is no response within four minutes, the connection is aborted.  This only applies to an established connection; if a connection is not established and is idle for one minute, it is aborted. 

NOTE

TCP implementations that do not closely follow the TCP specification
may not respond to keep-alive messages, causing connections to be
closed without reason.

DIAGNOSTICS

EISCONN
Trying to establish a connection on an already-connected socket

ENOBUFS
Does not have memory for an internal data structure

ETIMEDOUT
Connection dropped due to excessive retransmissions

ECONNRESET
Remote peer forced the connection to be closed

ECONNREFUSED
Remote peer actively refused to establish a connection (usually because no process is listening to the port)

EADDRINUSE
Attempted to create a socket on an already-allocated port

EADDRNOTAVAIL
Attempted to create a socket with an invalid network interface

SEE ALSO

net(7P), inet(7P)

BUGS

Value-added “features” such as keep-alives are experimental and are not part of the protocol standard. 

Version 2.4  —  May 08, 1986

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026