BSD Sockets Interface Programmer's Guide

174 Chapter 8
Programming Hints
Summary Tables for System and Library Calls
The following table contains a summary of the other system calls that
can be used with BSD Sockets.
Table 8-2 Other BSD Sockets System Calls
getsockname Gets the socket address of the specified socket.
getsockopt,
setsockopt
Gets, or sets, the options associated with a socket.
getpeername Gets the name of the peer socket connected to the
specified socket.
System Call Description
System Call Description
read Can be used to read data at stream or datagram
sockets just like recv or recvfrom , without the
benefit of the recv flags. Read offers implementation
independence; the descriptor can be for a file, a
socket or any other object.
write Can be used to write data from stream sockets (and
datagram sockets if you declare a default remote
socket address) just like send. Write offers
implementation independence; the descriptor can be
for a file, a socket or any other object.
close Deallocates socket descriptors. The last close can be
used to destroy a socket. Close does a graceful
disconnect or a hard close, depending on the
LINGER option. Refer to the sections on “Closing a
Socket.