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

Sending from datagram sockets (Internet domain)

Datagram sockets are created and name bound in the same ways as stream sockets; see ``Creating a socket (Internet domain)'' and ``Binding socket names (Internet domain)'' for these procedures. However, to send data from a datagram socket, the process uses the sendto primitive:

sendto(s, buf, buflen, flags, &to, tolen);

The parameters are the same as those described for send, except the to and tolen values are used to indicate the intended recipient of the message.

When using an unreliable datagram interface, it is unlikely any errors will be reported to the sender. If information at the sending node indicates that the message cannot be delivered (for example, when a network is unreachable), the call returns -1, and the global variable errno contains an error number.

For an example, see `` Sending an Internet domain datagram''.


Next topic: Receiving on datagram sockets (Internet domain)
Previous topic: Connectionless sockets (Internet domain)

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