When a connection is established, data flow can
begin using a number of possible calls.
If the peer entity at each end of a
connection is anchored (that is, there is a connection), a user
can send or receive a message without specifying the peer by
using read and write:
write(s, buf, sizeof (buf));
read(s, buf, sizeof (buf));
The calls send and recv are virtually identical to
read and write, except that a flags argument is added.
send(s, buf, sizeof (buf), flags);
recv(s, buf, sizeof (buf), flags);
The flags can be specified as a nonzero value if MSG_PEEK is required. MSG_PEEK allows the user to look at data without reading. When this value is specified in a recv call, any data present is returned to the user but treated as though still ``unread''. The next read or recv call applied to the socket returns the data previously previewed.