06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

send Sends data to a socket.<br />

#include <br />

long send(<br />

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

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

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

int flags /* packet attributes */<br />

)<br />

Description<br />

Arguments<br />

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

If no buffer space is available at the socket to hold the data to be transmitted,<br />

send() blocks 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 (see<br />

“Arguments,” below). Using mblks eliminates the data copy performed in the pNA+<br />

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

network manager.<br />

s Specifies the local socket, which must be in a connected state.<br />

If s is a stream socket, the data is sent to the foreign socket that is<br />

connected to s.<br />

If s is a datagram socket, the data is sent to the socket that has been<br />

associated with s through a previous connect() system call.<br />

If s is a raw socket, the raw datagram is sent to the raw socket that<br />

has been associated with s through a previous connect() system<br />

call.<br />

buf Points to a buffer containing the data to send. If s is a datagram<br />

socket, the data that buf points to is a datagram.<br />

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

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 4-57<br />

4

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

Saved successfully!

Ooh no, something went wrong!