DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing applications over TCP/IP using Internet sockets

Transferring data via a socket (Internet 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 nonzero values:


MSG_OOB
Send/receive out-of-band data. Out-of-band data is specific to stream sockets.

MSG_PEEK
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 will return the data previously previewed.

MSG_DONTROUTE
Send data without routing packets. (Used only by the routing table management process.)

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

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