Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ accept(2dn) — Ultrix DECnet 3.0 VAX

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bind(2dn)

listen(2dn)

setsockopt(2dn)

socket(2dn)

accept(2dn)

NAME

accept − accept a connect request

SYNTAX

#include <sys/types.h>
#include <sys/socket.h>
#include <netdnet/dn.h>

ns = accept (s,addr,addrlen)
int ns,s;
struct sockaddr_dn *addr;
int *addrlen;

ARGUMENTS

Input Arguments

s Specifies a descriptor for a socket that has been returned by the socket call, bound to a name by the bind call, and is listening for connects after issuing a listen call.

addr The address of a structure of the type sockaddr_dn. This address will identify the source entity that is requesting the connection.

addrlen
Specifies the size of the source address.

Return Arguments

ns The new descriptor for the accepted socket. 

addr Specifies the address of a structure of the type sockaddr_dn. The following fields are filled in by this call:

sdn_family Specifies the communications domain as AF_DECnet.

sd_objnum Specifies the source DECnet object number. 

sdn_objnamel
The size of the source’s object name. This argument is used only when the DECnet object number, sdn_objnum, is 0. 

sdn_objname Defines the name of the source network program, which can be up to 16 characters.  This argument is used only when the DECnet object number, sdn_objnum, is 0. 

sdn_nodeaddrl
The size of the node address for the source program.

sdn_nodeaddr
Specifies the node address for the source program.

addrlen Specifies the actual length, in bytes, of the returned address. 

DESCRIPTION

The accept call extracts the first connect request on the queue of pending connections, creates a new socket with the same properties as s, and allocates a new file descriptor, ns, for the socket.  The s remains open and listens for connect requests. 

There are two modes of accepting an incoming connection: immediate and deferred.  To specify the mode of acceptance use the setsockopt call.

Immediate mode, specified as ACC_IMMED, causes the client and server programs to complete the protocol exchange at the NSP level.  The server program ignores any access control information and optional data that may have been sent by the source program.  This is the default. 

Deferred mode, specified as ACC_DEFER, causes the accept call to be completed by the server program without a full protocol exchange between itself and the client program.  Deferred mode allows the server program to examine and process any access control information or optional data before notifying the client program of the acceptance or rejection or its connect request.

RETURN VALUE

If the accept call succeeds, it returns a nonnegative integer, which is a descriptor for the accepted socket.  If an error occurs, the call returns a value of −1. When an error condition exists, the external variable errno will contain the type of error.

DIAGNOSTICS

[EBADF] The s argument is not a valid descriptor. 

[EFAULT] The addr argument is not in a writeable part of the user address space. 

[EWOULDBLOCK] The socket is marked for nonblocking and no connections are waiting to be accepted. 

[ECONNABORTED] DECnet is shutting down on the local node. 

SEE ALSO

bind(2dn), listen(2dn), setsockopt(2dn), socket(2dn)

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