/* * The variable descriptor may be the descriptor of either a file * or of a socket. */ cc = read(descriptor, buf, nbytes) int cc, descriptor; char *buf; int nbytes; /* * An iovec can include several source buffers. */ cc = readv(descriptor, iov, iovcnt) int cc, descriptor; struct iovec *iov; int iovcnt; cc = write(descriptor, buf, nbytes) int cc, descriptor; char *buf; int nbytes; cc = writev(descriptor, iovec, ioveclen) int cc, descriptor; struct iovec *iovec; int ioveclen; /* * The variable ``sock'' must be the descriptor of a socket. * Flags may include MSG_OOB and MSG_PEEK. */ cc = send(sock, msg, len, flags) int cc, sock; char *msg; int len, flags; cc = sendto(sock, msg, len, flags, to, tolen) int cc, sock; char *msg; int len, flags; struct sockaddr *to; int tolen; cc = sendmsg(sock, msg, flags) int cc, sock; struct msghdr msg[]; int flags; cc = recv(sock, buf, len, flags) int cc, sock; char *buf; int len, flags; cc = recvfrom(sock, buf, len, flags, from, fromlen) int cc, sock; char *buf; int len, flags; struct sockaddr *from; int *fromlen; cc = recvmsg(sock, msg, flags) int cc, socket; struct msghdr msg[]; int flags;Figure 10 -- Varieties of read and write commands