1/29
Vocabulary flashcards covering Unix’s file-oriented design, process communication mechanisms, popen, the client/server paradigm, and the essential socket API calls and data structures needed to build networked applications.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Everything Is a File
Unix philosophy in which terminals, regular files, pipes, sockets, and many devices are all accessed through the same file-oriented interface.
File Descriptor (fd)
A small integer returned by the kernel that uniquely identifies an open file, pipe, or socket within a process.
Pipe
A unidirectional, in-memory buffer that lets one process write data for another to read, enabling parent/child communication.
Temporary File Buffer
A crude way to connect two independent processes by having one write to a file while the other reads; slow and hard to synchronize.
fopen()
C library call that opens a file on disk and returns a FILE* stream for buffered I/O.
fdopen()
Associates an existing file descriptor with a FILE* stream, allowing buffered I/O on an already-open descriptor.
popen()
Creates a pipe, forks, and runs a shell command, returning a FILE* connected to the child’s stdin ("w") or stdout ("r").
pclose()
Closes the FILE* obtained from popen() and waits for the associated process to terminate.
Interface (in IPC)
The agreed-upon rules—data formats, order of operations, expectations—that two communicating programs must follow.
Client
A program that actively initiates a connection to a server, expecting a service at a specific IP address and port.
Server
A long-running program that waits (listens) passively for incoming client connections on a known port.
Socket
An endpoint for bidirectional communication between processes, usually over a network, treated like a file descriptor.
PFINET / AFINET
Protocol/address family constant indicating an IPv4 Internet socket.
SOCK_STREAM
Socket type that provides reliable, byte-stream service (typically TCP).
SOCK_DGRAM
Socket type that provides connectionless, datagram service (typically UDP).
socket()
System call: int socket(domain, type, protocol); creates a socket and returns its file descriptor.
bind()
System call: int bind(fd, *addr, len); associates a server’s socket with a local address and port.
listen()
System call: int listen(fd, backlog); marks a bound socket as passive, ready to accept incoming connections, with a queue length of backlog.
backlog
The maximum number of pending client connections that can wait in the listen queue before accept().
accept()
System call: int accept(fd, *addr, *len); removes the next pending connection from the listen queue and returns a new socket for data transfer.
connect()
Client-side system call: int connect(fd, *addr, len); actively establishes a connection to a listening server socket.
sockaddr_in
Structure holding IPv4 address (sinaddr), port (sinport), and family (sin_family) information for socket calls.
gethostbyname()
Library function that converts a hostname into an IP address for populating sockaddr_in.
htons()
Function that converts a 16-bit value (e.g., port) from host byte order to network byte order.
read() / write()
Low-level system calls used on socket file descriptors to receive and transmit raw bytes.
IP Address
Numeric identifier (e.g., 192.168.1.5) that locates a host on an IP network; multiple sockets can share one IP.
Port Number
16-bit value identifying a specific application endpoint on a host; many hosts may use the same port for the same service type.
dup2()
System call that duplicates one file descriptor onto another, often redirecting a socket to stdin/stdout in forked processes.
execl()
exec-family call that replaces the current process image with a new program, inheriting existing file descriptors.
Fork-and-Delegate Web Server
Server model in which the listener process accepts a connection, forks, redirects the socket in the child, and execs a worker program so the parent can immediately handle new clients.