06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

sendto pNA+ <strong>System</strong> <strong>Calls</strong><br />

sendto Sends data to a socket.<br />

#include <br />

long sendto(<br />

int s, /* socket descriptor */<br />

char *buf, /* packet */<br />

int len, /* packet length */<br />

int flags, /* packet attribute */<br />

struct sockaddr_in *to, /* destination socket type */<br />

int tolen /* size of sockaddr_in */<br />

)<br />

Description<br />

Arguments<br />

The sendto() system call is used to send data to a foreign datagram socket.<br />

Although it is possible to use this system call with stream, datagram, or raw<br />

sockets, it is intended to be used only with datagram sockets or raw sockets.<br />

If no buffer space is available at the socket to hold the datagram, sendto() blocks<br />

the calling task unless the socket has been marked non-blocking.<br />

Applications can use this call to pass messages to the pNA+ network manager in a<br />

linked list of mblks (message blocks) by setting the MSG_RAWMEM flag. Using mblks<br />

eliminates the data copy performed in the pNA+ network manager during the data<br />

transfer between the application and the pNA+ network manager.<br />

s Specifies the local socket.<br />

buf Points to a buffer that contains the data to send. The data pointed to<br />

by buf is called a datagram.<br />

len Specifies the number of bytes in buf.<br />

flags Specifies usage options and is the result of an OR operation performed<br />

on one or more of the following symbolic constants (defined<br />

in ). It can also be set to 0.<br />

MSG_OOB Specifies that you want sendto() to send outof-band<br />

data, rather than the regular in-band<br />

data.<br />

4-62 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!