DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Interprocess communication using UNIX domain sockets

Transferring data via a socket (UNIX domain)

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.


Next topic: Closing sockets and discarding queued data (UNIX domain)
Previous topic: Connection errors (UNIX domain)

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003