Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

getsockopt(2)

ioctl(2)

socket(2)

SOCKET(7)  —  Series 300 and 800 Only

NAME

socket − Interprocess communications

DESCRIPTION

Sockets are communication endpoints that allow processes to communicate either locally or remotely.  They are accessed by means of a set of system calls.  (See socket(2).)

The following ioctl(2) requests are defined in <sys/ioctl.h>:

FIOSNBIO If the int whose address is pointed to by arg is non-zero, the socket is put into non-blocking mode. Otherwise, the socket is put into blocking mode. Blocking mode is the default. See accept(2), connect(2), recv(2), and send(2) for an explanation of how non-blocking mode is used.

FIONREAD For STREAM sockets, the number of bytes currently readable from this socket is returned in the int whose address is pointed to by arg. For DGRAM sockets, the number of bytes currently readable plus the sizeof(sockaddr), which is 16 bytes, is returned in the int whose address is pointed to by arg.

SIOCATMARK If on return the int whose address is pointed to by arg is non-zero, the inbound TCP stream has been read up to where the out-of-band data byte starts. 

SIOCSPGRP This request sets the process group associated with the socket. This is necessary in order to be signaled (SIGURG) upon the receipt of out-of-band data. The process id is passed via the arg parameter. If the process group is zero, no signal will be generated. If the process id associated with the socket is the negative process id, then the SIGURG signal will be sent to that process only. If the process id associated with the socket is the positive process id, then the SIGURG signal will be sent to all the processes in the process group. 

SIOCGPGRP This request gets the process id associated with the socket. The process id is returned via the arg parameter. Thus, arg is a pointer to an int. 

The fcntl(2) O_NDELAY flag is supported by sockets. If the O_NDELAY flag is set, then read(2)/recv(2) requests always return immediately. Write(2)/send(2) requests return immediately on a Series 800 and block on a Series 300. If no data are available on a read(2)/recv(2) request, and the request would thus normally block, the request returns with a byte count of zero, which is equivalent to returning an EOF condition.

Since both the fcntl(2) O_NDELAY flag and ioctl(2) FIOSNBIO flags are supported, some clarification on how these two calls interact is necessary. If the O_NDELAY flag has been set, read(2)/recv(2) and write(2)/send(2) requests behave accordingly, regardless of the state of the FIOSNBIO flag. If O_NDELAY has not been set, the FIOSNBIO flag controls the behavior of the read(2)/recv(2) and write(2)/send(2) requests.

DEPENDENCIES

Implemented on the Series 300 and 800 only. This entry describes the use of the TCP protocol as it applies to the Berkeley Interprocess Communication utility. It does not apply to the use of TCP for the LAN/9000 Series 800 NetIPC utility. Refer to the LAN/9000 Series 800 NetIPC Programmer’s Guide for information about NetIPC. 

The default send and receive buffer sizes for STREAM sockets is 4096 bytes.  The maximum send and receive buffer sizes are 65535 bytes.  The buffer sizes for STREAM sockets can be altered by the setsockopt(2) call.  Refer to socket(2) and getsockopt(2) for details. 

AUTHOR

UCB (University of California at Berkeley)

SEE ALSO

fcntl(2), getsockopt(2), ioctl(2), socket(2). 

Hewlett-Packard Company  —  May 11, 2021

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