Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ accept(2X) — UNIX 2.9BSD

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

connect(2x)

select(2x)

socket(2x)

ACCEPT(2X)  —  Unix Programmer’s Manual

NAME

accept − accept a connection on a socket

SYNOPSIS

#include <sys/socket.h> accept(s, from)
int s;
struct sockaddr ∗from;

DESCRIPTION

This call is used to accept a connection on socket s; from is a result value indicating the address of the entity which connected, as known to the communications layer.  This call is used with connection-based socket types, currently with SOCK_STREAM. 

If the underlying communications layer has already made a connection on the socket, then the call returns immediately.  If no connection has yet been made, and the socket is nonblocking (see ioctl(2)), then a −1 is returned and the global variable errno is set to EWOULDBLOCK. It is possible to select(2x) a socket for the purposes of doing an accept by selecting it for read, since no data may be read until the connection completes. 

SEE ALSO

connect(2x), select(2x), socket(2x)

DIAGNOSTICS

Zero is returned if a connection is accepted; −1 is returned in the error cases.  Some important error returned in errno are EOPNOTSUPP if the socket is not of a type supporting this operation, and EISCONN if the socket is already connected. 

BUGS

This call is provisional, and will exist in a slightly different form in 4.2bsd. 

7th Edition  —  3/17/82

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